Skip to content

Commit

Permalink
Specify encoding on language_load.py I/O
Browse files Browse the repository at this point in the history
  • Loading branch information
tupaschoal committed Apr 8, 2020
1 parent c61abc2 commit 723a8a7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions language_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
language_to_import = args.language
fallback_language = args.fallback

in_file = open(args.input)
in_file = open(args.input, encoding="utf8")
strings_by_object = json.load(in_file)
in_file.close()

Expand All @@ -38,7 +38,7 @@ def iterencode(self, o, _one_shot=False):
yield s

for filename in glob.iglob(args.objects + '/**/*.json', recursive=True):
file = open(filename)
file = open(filename, encoding="utf8")
data = json.load(file)
file.close()

Expand Down Expand Up @@ -80,7 +80,7 @@ def iterencode(self, o, _one_shot=False):
updated = True

if updated:
file = open(filename, "w")
file = open(filename, "w", encoding="utf8")
json.dump(data, file, indent=4, separators=(',', ': '), ensure_ascii=False, cls=LessVerboseJSONEncoder)
file.write("\n")
file.close()

0 comments on commit 723a8a7

Please sign in to comment.