Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support Chinese in config file #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions YEDDA.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def KeyDef2Dic(self):

def readConfig(self):
self.pressCommand = []
with open(self.configFile, 'r') as fp:
with open(self.configFile, 'r', encoding='utf-8') as fp:
config_dict = json.load(fp)
for index,entity in config_dict.items():
self.pressCommand.append(KeyDef(index,entity))
Expand Down Expand Up @@ -628,8 +628,8 @@ def renewPressCommand(self):
if self.debug:
print("Action Track: renewPressCommand")
self.pressCommand = self.keymap_frame.read_keymap()
with open(self.configFile, 'wb') as fp:
json.dump(self.KeyDef2Dic(self.pressCommand), fp)
with open(self.configFile, 'w', encoding='utf8') as fp:
json.dump(self.KeyDef2Dic(), fp, ensure_ascii=False)
self.keymap_frame.update_keymap(self.pressCommand)
messagebox.showinfo("Remap Notification",
"Shortcut map has been updated!\n\n" +
Expand All @@ -650,8 +650,8 @@ def savenewPressCommand(self):
# make sure ending with ".config"
if not self.configFile.endswith(".config"):
self.configFile += ".config"
with open(self.configFile, 'wb') as fp:
json.dump(self.KeyDef2Dic(self.pressCommand), fp)
with open(self.configFile, 'w', encoding='utf8') as fp:
json.dump(self.KeyDef2Dic(), fp, ensure_ascii=False)
self.keymap_frame.update_keymap(self.pressCommand)
messagebox.showinfo("Save New Map Notification",
"Shortcut map has been saved and updated!\n\n"
Expand Down