diff --git a/oml/pdict.py b/oml/pdict.py index 0ee9377..bd20b3e 100644 --- a/oml/pdict.py +++ b/oml/pdict.py @@ -17,8 +17,8 @@ class pdict(dict): def _save(self): if self._path: - with open(self._path, 'w') as fd: - json.dump(self, fd, indent=4, sort_keys=True) + with open(self._path, 'w', encoding='utf-8') as fd: + json.dump(self, fd, indent=4, sort_keys=True, ensure_ascii=False) def get(self, key, default=None): if default == None and self._defaults: diff --git a/oml/tasks.py b/oml/tasks.py index 079dcf5..fa75d42 100644 --- a/oml/tasks.py +++ b/oml/tasks.py @@ -107,7 +107,7 @@ class Tasks(Thread): def save_tasks(self): if self._tasks: logger.debug('saving %s tasks for later', len(self._tasks)) - with open(self._taskspath, 'w') as f: + with open(self._taskspath, 'w', encoding='utf-8') as f: json.dump(self._tasks, f) def join(self): diff --git a/oml/user/models.py b/oml/user/models.py index 980cd70..071a043 100644 --- a/oml/user/models.py +++ b/oml/user/models.py @@ -437,7 +437,7 @@ class List(db.Model): j['path'] = f.path break items.append(j) - with open(path, 'w') as f: + with open(path, 'w', encoding='utf-8') as f: json.dump(items, f, indent=4, default=_to_json, ensure_ascii=False, sort_keys=True) class Metadata(db.Model):