From: Jaroslav Kysela Date: Wed, 6 Apr 2016 15:18:36 +0000 (+0200) Subject: support/doc/md_to_c.py: try to fix python3 utf-8 issue X-Git-Tag: v4.2.1~724 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=45f69a73db8fc6b803c4b6a454021ef3e0201a5f;p=thirdparty%2Ftvheadend.git support/doc/md_to_c.py: try to fix python3 utf-8 issue --- diff --git a/support/doc/md_to_c.py b/support/doc/md_to_c.py index f35c465c9..4d2f93a90 100755 --- a/support/doc/md_to_c.py +++ b/support/doc/md_to_c.py @@ -23,6 +23,12 @@ DEBUG=False NOLANG_CHARS=" " +def utf8open(fn, mode): + if sys.version_info[0] < 3: + return open(fn, mode) + else: + return open(fn, mode, encoding='utf-8') + def debug(str): sys.stderr.write('DEBUG: ' + str + '\n') @@ -399,7 +405,7 @@ name = argv_get('name') if not name: fatal('Specify class name.') -fp = open(input) +fp = utf8open(input, 'r') text = fp.read(1024*1024*2) fp.close()