[Erp5-report] r28750 - /erp5/trunk/products/ERP5Type/patches/ppml.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Sep 2 15:39:24 CEST 2009


Author: kazuhiko
Date: Wed Sep  2 15:39:22 2009
New Revision: 28750

URL: http://svn.erp5.org?rev=28750&view=rev
Log:
if the input is not str but unicode, convert it to str, otherwise UnicodeEncodeError can be raised by exporting Page Template containing non-ASCII characters.

Modified:
    erp5/trunk/products/ERP5Type/patches/ppml.py

Modified: erp5/trunk/products/ERP5Type/patches/ppml.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/patches/ppml.py?rev=28750&r1=28749&r2=28750&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/patches/ppml.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/patches/ppml.py [utf8] Wed Sep  2 15:39:22 2009
@@ -45,7 +45,10 @@
     ###              [\x00-\x1f] characters will be escaped to make a more
     ###              readable output.
     try:
-        S.decode('utf8')
+        if isinstance(S, unicode):
+            S = S.encode('utf8')
+        else:
+            S.decode('utf8')
     except UnicodeDecodeError:
         new = ''.join([reprs3.get(x) for x in S])
     else:




More information about the Erp5-report mailing list