UnicodeDecodeError in geninclude.py reading event_axes.c
When building in a non-UTF-8 locale (in this case 'C'), because demos/gtk-demo/event_axes.c
contains Unicode characters.
Traceback (most recent call last):
File "/Users/john/Development/gtk-sources/gtk/demos/gtk-demo/geninclude.py", line 37, in <module>
title = f.readline().replace("/*", "").strip()
File "/Users/john/Development/gtk-build/gtk-unstable-10.9-x86_64/inst/lib/python3.6/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 2222: ordinal not in range(128)
The simplest fix is
--- a/demos/gtk-demo/geninclude.py
+++ b/demos/gtk-demo/geninclude.py
@@ -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()
though another option would be to require building in a UTF-8 locale.