diff --git a/find_missing_i18n_strings.py b/find_missing_i18n_strings.py index 06659933..47af6f07 100644 --- a/find_missing_i18n_strings.py +++ b/find_missing_i18n_strings.py @@ -3,7 +3,7 @@ import json # Open the json file and load its contents into a dictionary -with open('i18n/en.json', 'r') as f: +with open('i18n/en.json', 'r', encoding='utf-8') as f: en = json.load(f) # Create a copy of the en dictionary's keys and convert it to a set for better performance @@ -18,7 +18,7 @@ for file in files: if file.endswith('.html'): fullpath = os.path.join(folder, file) - with open(fullpath, 'r') as f: + with open(fullpath, 'r', encoding='utf-8') as f: for line in f: m = re.findall('{{\s+?i18n\s+?(?:"|`)(.*?)(?:"|`)\s+?}}', line, re.DOTALL) if m: @@ -42,5 +42,5 @@ else: print("No unused keys found.") - with open('i18n/en.json', 'w') as f: - json.dump(en, f, indent=3) + with open('i18n/en.json', 'w', encoding='utf-8') as f: + json.dump(en, f, indent=3, ensure_ascii=False)