Skip to content

Commit 4475f32

Browse files
committed
tools/tinytest-codegen: Ignore system locale, write output in UTF-8.
Way to reproduce a UnicodeEncodeError without this patch: LC_ALL=C tinytest-codegen.py ...
1 parent cf8e8c2 commit 4475f32

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tools/tinytest-codegen.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,5 @@ def script_to_map(test_file):
106106
output.append(testgroup_struct.format(body='\n'.join(testgroup_members)))
107107

108108
## XXX: may be we could have `--output <filename>` argument...
109-
print('\n\n'.join(output))
109+
# Don't depend on what system locale is set, use utf8 encoding.
110+
sys.stdout.buffer.write('\n\n'.join(output).encode('utf8'))

0 commit comments

Comments
 (0)