feat(tools): Enforce utf-8 encoding with open() function

This commit is contained in:
Marek Fiala
2024-07-23 15:59:09 +02:00
committed by BOT
parent 305f1c1e5b
commit 2c814ef2fa
40 changed files with 115 additions and 124 deletions

View File

@@ -16,7 +16,7 @@ def get_type(action: str) -> str:
def replace_in_file(filename: str, pattern: str, replacement: str) -> None:
with open(filename, 'r+') as f:
with open(filename, 'r+', encoding='utf-8') as f:
content = f.read()
overwritten_content = re.sub(pattern, replacement, content, flags=re.M)
f.seek(0)