Specify UTF-8 encoding for all open() calls

This commit is contained in:
Wanderrful 2020-09-19 15:28:55 -05:00
parent 68a230db4c
commit c0add3b9ca
1 changed files with 3 additions and 3 deletions

View File

@ -240,7 +240,7 @@ for d in data[1:]:
PERIPHERY_RULES_FILE = os.path.join('..', 'periphery-rules.rst') PERIPHERY_RULES_FILE = os.path.join('..', 'periphery-rules.rst')
rst = open(PERIPHERY_RULES_FILE, 'w') rst = open(PERIPHERY_RULES_FILE, 'w', encoding='utf8')
rst.write("""\ rst.write("""\
.. Do **not** modify this file it is generated from the periphery.csv file .. Do **not** modify this file it is generated from the periphery.csv file
@ -312,7 +312,7 @@ for rt in rule_tables:
rst.write('\n\n') rst.write('\n\n')
with open(rt.csv_fname, 'w', newline='') as f: with open(rt.csv_fname, 'w', newline='', encoding='utf8') as f:
w = csv.DictWriter(f, headers) w = csv.DictWriter(f, headers)
w.writeheader() w.writeheader()
for r in rt.rules: for r in rt.rules:
@ -331,5 +331,5 @@ for rt in rule_tables:
rst.close() rst.close()
with open(PERIPHERY_RULES_FILE) as f: with open(PERIPHERY_RULES_FILE, encoding='utf8') as f:
print(f.read()) print(f.read())