[Erp5-report] r18083 - /erp5/trunk/products/ERP5OOo/Document/OOoDocument.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Dec 6 19:02:35 CET 2007


Author: yusei
Date: Thu Dec  6 19:02:35 2007
New Revision: 18083

URL: http://svn.erp5.org?rev=18083&view=rev
Log:
convert to utf8 text, if possible. original text might not be utf8 encoding.

Modified:
    erp5/trunk/products/ERP5OOo/Document/OOoDocument.py

Modified: erp5/trunk/products/ERP5OOo/Document/OOoDocument.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/Document/OOoDocument.py?rev=18083&r1=18082&r2=18083&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/Document/OOoDocument.py (original)
+++ erp5/trunk/products/ERP5OOo/Document/OOoDocument.py Thu Dec  6 19:02:35 2007
@@ -350,13 +350,10 @@
       is_html = 1
     elif format in ('txt', 'text', 'text-content'):
       format_list = self.getTargetFormatList()
-      if format in format_list:
-        format = format_list[format_list.index(format)]
-      if 'txt' in format_list:
-        format = format_list[format_list.index('txt')]
-      elif 'text' in format_list:
-        format = format_list[format_list.index('text')]
-      else:
+      # if possible, we try to get utf8 text. ('enc.txt' will encode to utf8)
+      if 'enc.txt' in format_list:
+        format = 'enc.txt'
+      elif format not in format_list:
         return 'text/plain', self.asTextContent()
     # Raise an error if the format is not supported
     if not self.isTargetFormatAllowed(format):




More information about the Erp5-report mailing list