[Erp5-report] r21112 - /erp5/trunk/products/ERP5/Document/EmailDocument.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon May 26 09:55:49 CEST 2008


Author: nicolas
Date: Mon May 26 09:55:49 2008
New Revision: 21112

URL: http://svn.erp5.org?rev=21112&view=rev
Log:
Handle case when no encoding is detected

Modified:
    erp5/trunk/products/ERP5/Document/EmailDocument.py

Modified: erp5/trunk/products/ERP5/Document/EmailDocument.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/EmailDocument.py?rev=21112&r1=21111&r2=21112&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/EmailDocument.py (original)
+++ erp5/trunk/products/ERP5/Document/EmailDocument.py Mon May 26 09:55:49 2008
@@ -265,13 +265,13 @@
     for part in self._getMessage().walk():
       if part.get_content_type() == 'text/plain' and not text_result and not part.is_multipart():
         part_encoding = part.get_content_charset()
-        if part_encoding != 'utf-8':
+        if part_encoding not in (None, 'utf-8',):
           text_result = part.get_payload(decode=1).decode(part_encoding).encode('utf-8')
         else:
           text_result = part.get_payload(decode=1)
       elif part.get_content_type() == 'text/html' and not html_result and not part.is_multipart():
         part_encoding = part.get_content_charset()
-        if part_encoding != 'utf-8':
+        if part_encoding not in (None, 'utf-8',):
           return part.get_payload(decode=1).decode(part_encoding).encode('utf-8')
         return part.get_payload(decode=1)
     return text_result




More information about the Erp5-report mailing list