Commit 5107735c authored by Christoph Reiter's avatar Christoph Reiter

build: always use utf-8 when reading/writing text files

open() in text mode should never be used without an encoding because it defaults
to the locale encoding which is rarely what is wanted.

This fixes the Windows build in some cases (depending on the locale/paths used)
parent 7b42bade
......@@ -33,7 +33,7 @@ demos = []
for demo_file in in_files:
filename = demo_file[demo_file.rfind('/')+1:]
demo_name = filename.replace(".c", "")
with open(demo_file, 'r') as f:
with open(demo_file, 'r', encoding='utf-8') as f:
title = f.readline().replace("/*", "").strip()
......@@ -103,6 +103,6 @@ for demo in demos:
file_output += " { NULL }\n};\n"
ofile = open(out_file, "w")
ofile = open(out_file, "w", encoding="utf-8")
ofile.write(file_output)
ofile.close()
......@@ -26,7 +26,7 @@ xml += '''
if len(sys.argv) > 2:
outfile = sys.argv[2]
f = open(outfile, 'w')
f = open(outfile, 'w', encoding='utf-8')
f.write(xml)
f.close()
else:
......
......@@ -82,7 +82,7 @@ xml += '''
if len(sys.argv) > 2:
outfile = sys.argv[2]
f = open(outfile, 'w')
f = open(outfile, 'w', encoding='utf-8')
f.write(xml)
f.close()
else:
......
......@@ -8,14 +8,14 @@ out_file = sys.argv[1]
in_file = sys.argv[2]
old_msvc = sys.argv[3]
with open(out_file, 'w') as o:
with open(out_file, 'w', encoding='utf-8') as o:
if old_msvc is not None and old_msvc == "1":
o.write("#define ISOLATION_AWARE_ENABLED 1\n")
o.write('#include <winuser.h>\n')
with open(in_file, 'r') as f:
with open(in_file, 'r', encoding='utf-8') as f:
for line in f:
o.write(line)
o.write('\n')
o.write('ISOLATIONAWARE_MANIFEST_RESOURCE_ID RT_MANIFEST libgtk3.manifest')
\ No newline at end of file
o.write('ISOLATIONAWARE_MANIFEST_RESOURCE_ID RT_MANIFEST libgtk3.manifest')
......@@ -50,6 +50,6 @@ for f in funcs:
if debug: print (len(funcs), 'functions')
ofile = open(out_file, "w")
ofile = open_file(out_file, "w")
ofile.write(file_output)
ofile.close()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment