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

@@ -59,7 +59,7 @@ def remove_dir_with_files(dir):
def read_csv(filename):
"""Returns a list of lines."""
with open(filename, "r", newline='') as infile:
with open(filename, "r", encoding="utf-8", newline='') as infile:
lines = []
reader = csv.reader(infile)
for line in reader:
@@ -78,7 +78,7 @@ def read_csv_str(str):
def read_json(filename):
"""Returns a list or a dictionary."""
with open(filename, "r") as infile:
with open(filename, "r", encoding="utf-8") as infile:
return json.load(infile)
@@ -89,7 +89,7 @@ def read_json_str(str):
def read_file_to_list(filename):
"""Returns a list of lines."""
with open(filename, "r") as infile:
with open(filename, "r", encoding="utf-8") as infile:
return infile.readlines()