summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdebugger/system_routine/pre_cpp.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/debugger/system_routine/pre_cpp.py b/debugger/system_routine/pre_cpp.py
index effea0e28..584d2af02 100755
--- a/debugger/system_routine/pre_cpp.py
+++ b/debugger/system_routine/pre_cpp.py
@@ -33,7 +33,10 @@
import sys,re
-file = open(sys.argv[1], "r")
+# make sure both input file and stdout are handled as utf-8 text, regardless
+# of current locale (eg. LANG=C which tells python to use ascii encoding)
+sys.stdout = open(sys.__stdout__.fileno(), "a", encoding="utf-8")
+file = open(sys.argv[1], "r", encoding="utf-8")
lines = file.readlines()
len(lines)