Commit ddb7813a authored by Nicolas Delaby's avatar Nicolas Delaby

Handle non-exist encoding

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22433 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 482bdcf5
......@@ -281,7 +281,7 @@ class EmailDocument(File, TextDocument):
if part_encoding not in (None, 'utf-8',):
try:
text_result = part.get_payload(decode=1).decode(part_encoding).encode('utf-8')
except UnicodeDecodeError:
except (UnicodeDecodeError, LookupError):
text_result = part.get_payload(decode=1)
else:
text_result = part.get_payload(decode=1)
......@@ -290,7 +290,7 @@ class EmailDocument(File, TextDocument):
if part_encoding not in (None, 'utf-8',):
try:
return part.get_payload(decode=1).decode(part_encoding).encode('utf-8')
except UnicodeDecodeError:
except (UnicodeDecodeError, LookupError):
return part.get_payload(decode=1)
return part.get_payload(decode=1)
return text_result
......
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