diff --git a/product/ERP5/Document/EmailDocument.py b/product/ERP5/Document/EmailDocument.py index f8a7ede498e8ff2d4f2c26e408c64c03820b79f5..d07b4b349c48cbb47f29b3b9f825572be4e047f6 100644 --- a/product/ERP5/Document/EmailDocument.py +++ b/product/ERP5/Document/EmailDocument.py @@ -279,7 +279,10 @@ class EmailDocument(File, TextDocument): 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 not in (None, 'utf-8',): - text_result = part.get_payload(decode=1).decode(part_encoding).encode('utf-8') + try: + text_result = part.get_payload(decode=1).decode(part_encoding).encode('utf-8') + except UnicodeDecodeError: + text_result = part.get_payload(decode=1) else: text_result = part.get_payload(decode=1) elif part.get_content_type() == 'text/html' and not html_result and not part.is_multipart():