[FIX] misc: Force utf-8 decoding when opening a file

This commit is contained in:
Christophe Monniez
2017-10-03 12:01:52 +02:00
parent 0bab2e7fbd
commit 77df0e5b27
+4 -1
View File
@@ -215,7 +215,10 @@ def _fileopen(path, mode, basedir, pathinfo, basename=None):
# Give higher priority to module directories, which is
# a more common case than zipped modules.
if os.path.isfile(name):
fo = open(name, mode)
if 'b' in mode:
fo = open(name, mode)
else:
fo = io.open(name, mode, encoding='utf-8')
if pathinfo:
return fo, name
return fo