From 77df0e5b27745aa286d42e572b550acf57dd8746 Mon Sep 17 00:00:00 2001 From: Christophe Monniez Date: Wed, 20 Sep 2017 13:48:54 +0200 Subject: [PATCH] [FIX] misc: Force utf-8 decoding when opening a file --- odoo/tools/misc.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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