Make ctml_writer more tolerant of files with non-ascii characters
This is an issue specifically when using Python 3 to run ctml_writer
This commit is contained in:
parent
a99004d8ef
commit
0c0a38d4fe
1 changed files with 2 additions and 1 deletions
|
|
@ -2616,9 +2616,10 @@ def convert(filename=None, outName=None, text=None):
|
|||
elif outName is None:
|
||||
outName = 'STDOUT'
|
||||
|
||||
open_kw = {'encoding': 'latin-1'} if sys.version_info.major == 3 else {}
|
||||
try:
|
||||
if filename is not None:
|
||||
with open(filename, 'rU') as f:
|
||||
with open(filename, 'rU', **open_kw) as f:
|
||||
code = compile(f.read(), filename, 'exec')
|
||||
else:
|
||||
code = compile(text, '<string>', 'exec')
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue