Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
support/doc/md_to_c.py: try to fix python3 utf-8 issue
  • Loading branch information
perexg committed Apr 6, 2016
1 parent a9cd108 commit 45f69a7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion support/doc/md_to_c.py
Expand Up @@ -23,6 +23,12 @@

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')

Expand Down Expand Up @@ -399,7 +405,7 @@ def argv_get(what):
if not name:
fatal('Specify class name.')

fp = open(input)
fp = utf8open(input, 'r')
text = fp.read(1024*1024*2)
fp.close()

Expand Down

0 comments on commit 45f69a7

Please sign in to comment.