1 From 2f5a4c708d90fa8db21f446ae879cff79387448d Mon Sep 17 00:00:00 2001
2 From: Khem Raj <raj.khem@gmail.com>
3 Date: Mon, 20 May 2013 21:03:16 -0700
4 Subject: [PATCH] h2py: Fix issue 13032 where it fails with UnicodeDecodeError
6 use utf-8 to open the files
8 Signed-off-by: Khem Raj <raj.khem@gmail.com>
10 Upstream-Status: Pending
12 Tools/scripts/h2py.py | 4 ++--
13 1 file changed, 2 insertions(+), 2 deletions(-)
15 diff --git a/Tools/scripts/h2py.py b/Tools/scripts/h2py.py
16 index 4f871d9..a53fbe0 100755
17 --- a/Tools/scripts/h2py.py
18 +++ b/Tools/scripts/h2py.py
19 @@ -69,13 +69,13 @@ def main():
20 sys.stdout.write('# Generated by h2py from stdin\n')
21 process(sys.stdin, sys.stdout)
23 - fp = open(filename, 'r')
24 + fp = open(filename, 'r', encoding='utf-8')
25 outfile = os.path.basename(filename)
26 i = outfile.rfind('.')
27 if i > 0: outfile = outfile[:i]
28 modname = outfile.upper()
29 outfile = modname + '.py'
30 - outfp = open(outfile, 'w')
31 + outfp = open(outfile, 'w', encoding='utf-8')
32 outfp.write('# Generated by h2py from %s\n' % filename)
34 for dir in searchdirs: