fix #30: enforce utf-8 encoding

since windows used non-utf8-encoding
This commit is contained in:
u231053
2022-12-19 16:39:28 +01:00
committed by Roland Kurmann
parent 7af4017910
commit a51507b701
4 changed files with 6 additions and 7 deletions

View File

@@ -305,7 +305,7 @@ def open_file_or_stdout(filename):
'''stdout is denoted as "-".
Note: Set before the following line:
sys.stdout.close = lambda: None'''
return open(filename, "w") if filename != '-' else sys.stdout
return open(filename, "w", encoding='utf-8') if filename != '-' else sys.stdout
def open_file_or_stdout_for_csv(filename):
@@ -313,7 +313,7 @@ def open_file_or_stdout_for_csv(filename):
newline=''
Note: Set before the following line:
sys.stdout.close = lambda: None'''
return open(filename, "w", newline='') if filename != '-' else sys.stdout
return open(filename, "w", encoding='utf-8', newline='') if filename != '-' else sys.stdout
def eprint(*args, **kwargs):