Commit 094b9091 authored by Nicolas Delaby's avatar Nicolas Delaby

Event chardet is not able to find True encoding, so return allways something

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25280 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 413380b6
...@@ -303,7 +303,10 @@ class EmailDocument(File, TextDocument): ...@@ -303,7 +303,10 @@ class EmailDocument(File, TextDocument):
except (UnicodeDecodeError, LookupError): except (UnicodeDecodeError, LookupError):
codec = self._guessEncoding(message_text) codec = self._guessEncoding(message_text)
if codec is not None: if codec is not None:
try:
text_result = message_text.decode(codec).encode('utf-8') text_result = message_text.decode(codec).encode('utf-8')
except (UnicodeDecodeError, LookupError):
text_result = repr(message_text)
else: else:
text_result = repr(message_text) text_result = repr(message_text)
else: else:
...@@ -320,7 +323,10 @@ class EmailDocument(File, TextDocument): ...@@ -320,7 +323,10 @@ class EmailDocument(File, TextDocument):
except (UnicodeDecodeError, LookupError): except (UnicodeDecodeError, LookupError):
codec = self._guessEncoding(message_text) codec = self._guessEncoding(message_text)
if codec is not None: if codec is not None:
try:
text_result = message_text.decode(codec).encode('utf-8') text_result = message_text.decode(codec).encode('utf-8')
except (UnicodeDecodeError, LookupError):
text_result = repr(message_text)
else: else:
text_result = repr(message_text) text_result = repr(message_text)
else: else:
......
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