From 3e396b3782813d36d46195564cd0e111422bcaf5 Mon Sep 17 00:00:00 2001 From: Daniel Mensinger Date: Tue, 22 Jun 2021 22:59:16 +0200 Subject: fix: Always explicitly set encoding for text files (fixes #8263) --- tools/dircondenser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools/dircondenser.py') diff --git a/tools/dircondenser.py b/tools/dircondenser.py index 9d642d2..2a726df 100755 --- a/tools/dircondenser.py +++ b/tools/dircondenser.py @@ -54,11 +54,11 @@ def get_entries() -> T.List[T.Tuple[int, str]]: return entries def replace_source(sourcefile: str, replacements: T.List[T.Tuple[str, str]]) -> None: - with open(sourcefile) as f: + with open(sourcefile, encoding='utf-8') as f: contents = f.read() for old_name, new_name in replacements: contents = contents.replace(old_name, new_name) - with open(sourcefile, 'w') as f: + with open(sourcefile, 'w', encoding='utf-8') as f: f.write(contents) def condense(dirname: str) -> None: -- cgit v1.1