diff --git a/product/ERP5Type/patches/ppml.py b/product/ERP5Type/patches/ppml.py
index 2cdb1b8c33c8f640a5b49b3468d5803c8d575497..92a1b79debb7d38240ce95f24553511b7614667b 100644
--- a/product/ERP5Type/patches/ppml.py
+++ b/product/ERP5Type/patches/ppml.py
@@ -45,7 +45,10 @@ def convert(S, find=None):
     ###              [\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: