Skip to content

Commit

Permalink
tools/tinytest-codegen: Ignore system locale, write output in UTF-8.
Browse files Browse the repository at this point in the history
Way to reproduce a UnicodeEncodeError without this patch:

    LC_ALL=C tinytest-codegen.py ...
  • Loading branch information
pfalcon committed Dec 15, 2017
1 parent 1fbe4ac commit 8dda252
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tools/tinytest-codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,5 @@ def script_to_map(test_file):
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'))

0 comments on commit 8dda252

Please sign in to comment.