From 48606de85b1900ded9a5cd8df4c09f7b3a70e7d5 Mon Sep 17 00:00:00 2001
From: Sebastien Robin <seb@nexedi.com>
Date: Tue, 31 Aug 2004 13:33:08 +0000
Subject: [PATCH] make the export still working with iso-8859-1, but of course
 use utf-8 by default

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1466 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/XMLExportImport.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/product/ERP5Type/XMLExportImport.py b/product/ERP5Type/XMLExportImport.py
index ba37c7f2ae..fb53e66621 100755
--- a/product/ERP5Type/XMLExportImport.py
+++ b/product/ERP5Type/XMLExportImport.py
@@ -145,6 +145,8 @@ def Base_asXML(object, ident=0):
           variable_type = "string" # Somewhat bad, should find a better way
           if workflow_variable.find('time')>= 0:
             variable_type = "date"
+          if workflow_variable.find('language_revs')>= 0: # XXX specific to cps
+            variable_type = "dict"
           xml += ident_string + '    <%s type=\"%s\">%s' % (workflow_variable,
                               variable_type,workflow_action[workflow_variable])
           xml += '</%s>\n' % workflow_variable
@@ -177,7 +179,11 @@ def Base_asXML(object, ident=0):
   if type(xml) is type(u"a"):
     xml_unicode = xml
   else:
-    xml_unicode = unicode(xml,encoding='UTF-8')
+    try:
+      xml_unicode = unicode(xml,encoding='UTF-8')
+    except UnicodeDecodeError:
+      LOG('Base_asXML, We should have an UTF-8 encoding,',0,'but we have ISO-8859-1')
+      xml_unicode = unicode(xml,encoding='ISO-8859-1')
   # This following character is quite strange, and parseString
   # fails, but when printed, it show a '\n' and a space, so I replace
   xml_unicode = xml_unicode.replace('\x0c','\n ')
-- 
2.30.9