Use utf-8 encoding while formatting translations on Windows. (#376)

When running sync_translations.py on Windows, an error will show because it use gbk encoding by default. Using utf-8 encoding explicitly can fix it.
This commit is contained in:
six-6 2023-06-08 00:14:41 +08:00 committed by GitHub
parent b05dfd10d2
commit b4177b5267
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,5 +34,5 @@ baseline = parse_strings_file("res/values/strings.xml")
for strings_file in glob.glob("res/values-*/strings.xml"): for strings_file in glob.glob("res/values-*/strings.xml"):
print(strings_file) print(strings_file)
strings = dict(parse_strings_file(strings_file)) strings = dict(parse_strings_file(strings_file))
with open(strings_file, "w") as out: with open(strings_file, "w", encoding="utf-8") as out:
write_updated_strings(out, baseline, strings) write_updated_strings(out, baseline, strings)