diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/decodetree.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/scripts/decodetree.py b/scripts/decodetree.py index 47aa9caf6d..4637b633e7 100644 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -20,6 +20,7 @@ # See the syntax and semantics in docs/devel/decodetree.rst. # +import io import os import re import sys @@ -1304,7 +1305,7 @@ def main(): for filename in args: input_file = filename - f = open(filename, 'r') + f = open(filename, 'rt', encoding='utf-8') parse_file(f, toppat) f.close() @@ -1324,9 +1325,11 @@ def main(): prop_size(stree) if output_file: - output_fd = open(output_file, 'w') + output_fd = open(output_file, 'wt', encoding='utf-8') else: - output_fd = sys.stdout + output_fd = io.TextIOWrapper(sys.stdout.buffer, + encoding=sys.stdout.encoding, + errors="ignore") output_autogen() for n in sorted(arguments.keys()): |