blob: dd6b24fe922e8b05b25f0e45a4c6b5f3edcad8a3 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001From 2f5a4c708d90fa8db21f446ae879cff79387448d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 20 May 2013 21:03:16 -0700
4Subject: [PATCH] h2py: Fix issue 13032 where it fails with UnicodeDecodeError
5
6use utf-8 to open the files
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9
10Upstream-Status: Pending
11---
12 Tools/scripts/h2py.py | 4 ++--
13 1 file changed, 2 insertions(+), 2 deletions(-)
14
15diff --git a/Tools/scripts/h2py.py b/Tools/scripts/h2py.py
16index 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)
22 else:
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)
33 filedict = {}
34 for dir in searchdirs:
35--
361.8.1.2
37