From 4475f324202e15b98f2f365e33078aebcf0bc5a5 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky <pfalcon@users.sourceforge.net>
Date: Fri, 15 Dec 2017 11:37:32 +0200
Subject: [PATCH] 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 ...
---
 tools/tinytest-codegen.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/tinytest-codegen.py b/tools/tinytest-codegen.py
index 5339972cd..ad3b3bbec 100755
--- a/tools/tinytest-codegen.py
+++ b/tools/tinytest-codegen.py
@@ -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'))
-- 
GitLab