1 From e9e9df216180bcecc5d4c17bbe48b2efd88b3ed2 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?R=C3=A9mi=20Cardona?= <remi@gentoo.org>
3 Date: Mon, 18 Aug 2014 00:44:32 +0200
4 Subject: [PATCH] shader-debugger: Force file/stdout IO as UTF-8
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 Not all locales on linux are UTF-8, the most notable being the C locale.
10 Python will use the ASCII codec for stream IO in this case and will barf
11 on the Copyright sign at the top of .g4a files.
13 Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=519434
14 Signed-off-by: Rémi Cardona <remi@gentoo.org>
16 debugger/system_routine/pre_cpp.py | 5 ++++-
17 1 file changed, 4 insertions(+), 1 deletion(-)
19 diff --git a/debugger/system_routine/pre_cpp.py b/debugger/system_routine/pre_cpp.py
20 index effea0e..584d2af 100755
21 --- a/debugger/system_routine/pre_cpp.py
22 +++ b/debugger/system_routine/pre_cpp.py
27 -file = open(sys.argv[1], "r")
28 +# make sure both input file and stdout are handled as utf-8 text, regardless
29 +# of current locale (eg. LANG=C which tells python to use ascii encoding)
30 +sys.stdout = open(sys.__stdout__.fileno(), "a", encoding="utf-8")
31 +file = open(sys.argv[1], "r", encoding="utf-8")
33 lines = file.readlines()