From b4177b52676321cd4a5fe7a336a4f09e50274f86 Mon Sep 17 00:00:00 2001 From: six-6 <1195132772@qq.com> Date: Thu, 8 Jun 2023 00:14:41 +0800 Subject: [PATCH] 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. --- sync_translations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sync_translations.py b/sync_translations.py index f0bb542..97c0ecc 100644 --- a/sync_translations.py +++ b/sync_translations.py @@ -34,5 +34,5 @@ baseline = parse_strings_file("res/values/strings.xml") for strings_file in glob.glob("res/values-*/strings.xml"): print(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)