From b78d304531bfe2359baf40db06099d9158d398d4 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 17 Sep 2023 12:43:43 +0200 Subject: Always write C code in UTF-8 Some people apparently use non-utf8 locales and this caused errors when xcb-proto started using some "fancy" quote marks. Fix this by always using utf8 encoding. Fixes: https://gitlab.freedesktop.org/xorg/lib/libxcb/-/issues/72 Signed-off-by: Uli Schlachter --- src/c_client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/c_client.py b/src/c_client.py index 182b5de..b7db543 100644 --- a/src/c_client.py +++ b/src/c_client.py @@ -331,7 +331,7 @@ def c_close(self): _h(' */') # Write header file - hfile = open('%s.h' % _ns.header, 'w') + hfile = open('%s.h' % _ns.header, 'w', encoding='UTF-8') for list in _hlines: for line in list: hfile.write(line) @@ -339,7 +339,7 @@ def c_close(self): hfile.close() # Write source file - cfile = open('%s.c' % _ns.header, 'w') + cfile = open('%s.c' % _ns.header, 'w', encoding='UTF-8') for list in _clines: for line in list: cfile.write(line) -- cgit v1.2.3