Read and write the config file as UTF-8.

This commit is contained in:
voussoir 2018-08-11 17:57:19 -07:00
parent fb052a2d56
commit 9eb9220ca9

View file

@ -1528,7 +1528,7 @@ class PhotoDB(
user_config_exists = self.config_filepath.is_file user_config_exists = self.config_filepath.is_file
needs_dump = False needs_dump = False
if user_config_exists: if user_config_exists:
with open(self.config_filepath.absolute_path, 'r') as handle: with open(self.config_filepath.absolute_path, 'r', encoding='utf-8') as handle:
user_config = json.load(handle) user_config = json.load(handle)
my_keys = helpers.recursive_dict_keys(config) my_keys = helpers.recursive_dict_keys(config)
stored_keys = helpers.recursive_dict_keys(user_config) stored_keys = helpers.recursive_dict_keys(user_config)
@ -1545,7 +1545,7 @@ class PhotoDB(
return config return config
def save_config(self): def save_config(self):
with open(self.config_filepath.absolute_path, 'w') as handle: with open(self.config_filepath.absolute_path, 'w', encoding='utf-8') as handle:
handle.write(json.dumps(self.config, indent=4, sort_keys=True)) handle.write(json.dumps(self.config, indent=4, sort_keys=True))