[Erp5-report] r25280 - /erp5/trunk/products/ERP5/Document/EmailDocument.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Jan 22 17:39:39 CET 2009
Author: nicolas
Date: Thu Jan 22 17:39:36 2009
New Revision: 25280
URL: http://svn.erp5.org?rev=25280&view=rev
Log:
Event chardet is not able to find True encoding, so return allways something
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=25280&r1=25279&r2=25280&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/EmailDocument.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/EmailDocument.py [utf8] Thu Jan 22 17:39:36 2009
@@ -303,7 +303,10 @@
except (UnicodeDecodeError, LookupError):
codec = self._guessEncoding(message_text)
if codec is not None:
- text_result = message_text.decode(codec).encode('utf-8')
+ try:
+ text_result = message_text.decode(codec).encode('utf-8')
+ except (UnicodeDecodeError, LookupError):
+ text_result = repr(message_text)
else:
text_result = repr(message_text)
else:
@@ -320,7 +323,10 @@
except (UnicodeDecodeError, LookupError):
codec = self._guessEncoding(message_text)
if codec is not None:
- text_result = message_text.decode(codec).encode('utf-8')
+ try:
+ text_result = message_text.decode(codec).encode('utf-8')
+ except (UnicodeDecodeError, LookupError):
+ text_result = repr(message_text)
else:
text_result = repr(message_text)
else:
More information about the Erp5-report
mailing list