summaryrefslogtreecommitdiff
path: root/morphlib/morph2.py
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2014-07-15 12:23:49 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2014-07-15 12:23:49 +0000
commite8adedb8f3f27d9212caf277b8e8f7c6792a20c2 (patch)
treef8460c9ff73cea780d944f18d1bab49f2653b1cf /morphlib/morph2.py
parent3f686a074fdb66e75e67e276d21bdc604b34920c (diff)
parent40a5c752de62dd1b3ef3ec0850f1f24e7af67052 (diff)
downloadmorph-e8adedb8f3f27d9212caf277b8e8f7c6792a20c2.tar.gz
Fix JSON file handling to be binary filename safe
Reviewed-by: Lars Wirzenius Reviewed-by: Pedro Alvarez
Diffstat (limited to 'morphlib/morph2.py')
-rw-r--r--morphlib/morph2.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/morphlib/morph2.py b/morphlib/morph2.py
index cc6ce926..83971bb8 100644
--- a/morphlib/morph2.py
+++ b/morphlib/morph2.py
@@ -66,11 +66,12 @@ class Morphology(object):
@staticmethod
def _load_json(text):
- return json.loads(text, object_pairs_hook=OrderedDict)
+ return json.loads(text, object_pairs_hook=OrderedDict,
+ encoding='unicode-escape')
@staticmethod
def _dump_json(obj, f):
- text = json.dumps(obj, indent=4)
+ text = json.dumps(obj, indent=4, encoding='unicode-escape')
text = re.sub(" \n", "\n", text)
f.write(text)
f.write('\n')