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

This commit is contained in:
Marek Fiala
2025-01-10 13:52:58 +08:00
committed by BOT
parent 73d1c139e7
commit b37383f75b
39 changed files with 113 additions and 125 deletions
+1 -1
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)