From 5cddc4d88fcc90a0cdd22c6151557101b9c81476 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Wed, 1 Mar 2006 10:07:19 +0000
Subject: [PATCH] Explicily encode the unicode object from gettext to utf8, to
 prevent implicit encode in ascii which will fail with non ascii chars.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5869 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/patches/Localizer.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/product/ERP5Type/patches/Localizer.py b/product/ERP5Type/patches/Localizer.py
index d169ef26b9..8f247350dc 100755
--- a/product/ERP5Type/patches/Localizer.py
+++ b/product/ERP5Type/patches/Localizer.py
@@ -65,7 +65,9 @@ def Localizer_translate(self, domain, msgid, mapping=None, *args, **kw):
 
     # Map the translated string with given parameters
     if type(mapping) is type({}):
-      return Template(translated_str).substitute(mapping)
+      if isinstance(translated_str, unicode) :
+        translated_str = translated_str.encode('utf8')
+      return unicode(Template(translated_str).substitute(mapping), 'utf8')
     return translated_str
 
 def GlobalTranslationService_translate(self, domain, msgid, *args, **kw):
-- 
2.30.9