diff options
author | lovetox <philipp@hoerist.com> | 2022-05-13 22:43:21 +0300 |
---|---|---|
committer | lovetox <philipp@hoerist.com> | 2022-05-13 22:43:21 +0300 |
commit | 7becee59338bddf3c31a15165e2e028649f624e1 (patch) | |
tree | 69d340bb480b69a957378842d8d5534d67413409 /scripts | |
parent | a86e178a3c72e00b99c2af302ce8cfa5245f53ee (diff) |
fix: Set encoding when calling open()
Otherwise the platform default will be taken, for example on Windows
this is not utf8.
Fixes #10849
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/dev/generate_ui_types.py | 2 | ||||
-rw-r--r-- | scripts/update_translations.py | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/scripts/dev/generate_ui_types.py b/scripts/dev/generate_ui_types.py index 2e770e9fb..928764e07 100755 --- a/scripts/dev/generate_ui_types.py +++ b/scripts/dev/generate_ui_types.py @@ -80,7 +80,7 @@ def parse(path, file): builder_names = [] -with out_path.open(mode='w') as file: +with out_path.open(mode='w', encoding='utf8') as file: file.write(IMPORTS) for path in paths: if path.name.endswith('~'): diff --git a/scripts/update_translations.py b/scripts/update_translations.py index 678057417..4574dd8ef 100644 --- a/scripts/update_translations.py +++ b/scripts/update_translations.py @@ -21,7 +21,7 @@ TRANSLATABLE_FILES = [ def template_is_equal(old_template_path: Path, new_template: str) -> bool: - with open(old_template_path, 'r') as f: + with open(old_template_path, 'r', encoding='utf8') as f: old_template = f.read() pattern = r'"POT-Creation-Date: .*\n"' @@ -64,7 +64,7 @@ def update_translation_template() -> bool: # No new strings were discovered return False - with open(TRANS_TEMPLATE, 'w') as f: + with open(TRANS_TEMPLATE, 'w', encoding='utf8') as f: f.write(template) return True |