From 7a2961da760ea2a713dbd05741e7b46c3f133dbb Mon Sep 17 00:00:00 2001
From: Xavier Morel <xmo@openerp.com>
Date: Mon, 14 Jul 2014 13:42:35 +0200
Subject: [PATCH] [FIX] ensure all g_inner content is correctly encoded

fixes #1130

* provided `inner` data may or may not have been encoded
* `element.text` is either ascii-compatible `str` or `unicode` when
  non-ascii-compatible, which could force the decoding of utf8-encoded content
  during g_inner's join
---
 openerp/addons/base/ir/ir_qweb.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/openerp/addons/base/ir/ir_qweb.py b/openerp/addons/base/ir/ir_qweb.py
index 918f54f8bc5a..741f8d45b84b 100644
--- a/openerp/addons/base/ir/ir_qweb.py
+++ b/openerp/addons/base/ir/ir_qweb.py
@@ -302,9 +302,9 @@ class QWeb(orm.AbstractModel):
         # qwebcontext: values
         # inner: optional innerXml
         if inner:
-            g_inner = inner
+            g_inner = inner.encode('utf-8') if isinstance(inner, unicode) else inner
         else:
-            g_inner = [] if element.text is None else [element.text]
+            g_inner = [] if element.text is None else [element.text.encode('utf-8')]
             for current_node in element.iterchildren(tag=etree.Element):
                 try:
                     g_inner.append(self.render_node(current_node, qwebcontext))
-- 
GitLab