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 ...
This commit is contained in:
Paul Sokolovsky 2017-12-15 11:37:32 +02:00
parent cf8e8c29e7
commit 4475f32420
1 changed files with 2 additions and 1 deletions

View File

@ -106,4 +106,5 @@ testgroup_members = [testgroup_member.format(name=group) for group in [""]]
output.append(testgroup_struct.format(body='\n'.join(testgroup_members)))
## XXX: may be we could have `--output <filename>` argument...
print('\n\n'.join(output))
# Don't depend on what system locale is set, use utf8 encoding.
sys.stdout.buffer.write('\n\n'.join(output).encode('utf8'))