[Erp5-report] r26499 - /erp5/trunk/products/ERP5/Document/EmailDocument.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Sun Apr 19 15:13:48 CEST 2009
Author: jp
Date: Sun Apr 19 15:13:47 2009
New Revision: 26499
URL: http://svn.erp5.org?rev=26499&view=rev
Log:
Make the accessor more robust. Remove starting and trailing ' from result
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=26499&r1=26498&r2=26499&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/EmailDocument.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/EmailDocument.py [utf8] Sun Apr 19 15:13:47 2009
@@ -140,9 +140,12 @@
except (UnicodeDecodeError, LookupError), error_message:
encoding = self._guessEncoding(text)
if encoding is not None:
- text = text.decode(encoding).encode('utf-8')
+ try:
+ text = text.decode(encoding).encode('utf-8')
+ except (UnicodeDecodeError, LookupError), error_message:
+ text = repr(text)[1:-1]
else:
- text = repr(text)
+ text = repr(text)[1:-1]
if name in result:
result[name] = '%s %s' % (result[name], text)
else:
More information about the Erp5-report
mailing list