Commit b589d1fd authored by Nicolas Delaby's avatar Nicolas Delaby

Handle declared wrong enconding

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22413 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7f496a44
...@@ -279,7 +279,10 @@ class EmailDocument(File, TextDocument): ...@@ -279,7 +279,10 @@ class EmailDocument(File, TextDocument):
if part.get_content_type() == 'text/plain' and not text_result and not part.is_multipart(): if part.get_content_type() == 'text/plain' and not text_result and not part.is_multipart():
part_encoding = part.get_content_charset() part_encoding = part.get_content_charset()
if part_encoding not in (None, 'utf-8',): if part_encoding not in (None, 'utf-8',):
try:
text_result = part.get_payload(decode=1).decode(part_encoding).encode('utf-8') text_result = part.get_payload(decode=1).decode(part_encoding).encode('utf-8')
except UnicodeDecodeError:
text_result = part.get_payload(decode=1)
else: else:
text_result = part.get_payload(decode=1) text_result = part.get_payload(decode=1)
elif part.get_content_type() == 'text/html' and not html_result and not part.is_multipart(): elif part.get_content_type() == 'text/html' and not html_result and not part.is_multipart():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment