summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Monniez <moc@odoo.com>2017-09-20 13:48:54 +0200
committerChristophe Monniez <moc@odoo.com>2017-10-03 12:01:52 +0200
commit77df0e5b27745aa286d42e572b550acf57dd8746 (patch)
tree1af4159ed515486d3f58e02dd191b7908c9af651
parent0bab2e7fbd1b39860f480dbb673814d380e2ad34 (diff)
[FIX] misc: Force utf-8 decoding when opening a file
-rw-r--r--odoo/tools/misc.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/odoo/tools/misc.py b/odoo/tools/misc.py
index 7e796831f29..49f8024c5ed 100644
--- a/odoo/tools/misc.py
+++ b/odoo/tools/misc.py
@@ -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