Commit d6f39f4b authored by Jean-Paul Smets's avatar Jean-Paul Smets

Guess encoding if the provided one does not exist.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26498 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9c80571b
......@@ -137,7 +137,7 @@ class EmailDocument(File, TextDocument):
text = text.decode(encoding).encode('utf-8')
else:
text = text.decode().encode('utf-8')
except UnicodeDecodeError:
except (UnicodeDecodeError, LookupError), error_message:
encoding = self._guessEncoding(text)
if encoding is not None:
text = text.decode(encoding).encode('utf-8')
......
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