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

Make the accessor more robust. Remove starting and trailing ' from result

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26499 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d6f39f4b
...@@ -140,9 +140,12 @@ class EmailDocument(File, TextDocument): ...@@ -140,9 +140,12 @@ class EmailDocument(File, TextDocument):
except (UnicodeDecodeError, LookupError), error_message: except (UnicodeDecodeError, LookupError), error_message:
encoding = self._guessEncoding(text) encoding = self._guessEncoding(text)
if encoding is not None: if encoding is not None:
try:
text = text.decode(encoding).encode('utf-8') text = text.decode(encoding).encode('utf-8')
except (UnicodeDecodeError, LookupError), error_message:
text = repr(text)[1:-1]
else: else:
text = repr(text) text = repr(text)[1:-1]
if name in result: if name in result:
result[name] = '%s %s' % (result[name], text) result[name] = '%s %s' % (result[name], 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