diff options
author | Ivan Alejandro <ivanalejandro0@gmail.com> | 2014-01-17 15:07:37 -0300 |
---|---|---|
committer | Ivan Alejandro <ivanalejandro0@gmail.com> | 2014-01-17 15:43:25 -0300 |
commit | 28694a321a81f4cbe5f4873cdc55e6d3f471dd48 (patch) | |
tree | 476d4948ecface407f069a64d0177d933f71ad66 /src/leap/mail/imap/messages.py | |
parent | 7b558eb23208d6de0b115fa453334421cc941e44 (diff) |
Fix encodings usage, use custom json.loads method.
Also remove some unused imports.
Diffstat (limited to 'src/leap/mail/imap/messages.py')
-rw-r--r-- | src/leap/mail/imap/messages.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/leap/mail/imap/messages.py b/src/leap/mail/imap/messages.py index 22de356..28bd272 100644 --- a/src/leap/mail/imap/messages.py +++ b/src/leap/mail/imap/messages.py @@ -494,8 +494,8 @@ class LeapMessage(fields, MailParser, MBoxParser): if not charset: charset = self._get_charset(body) try: - body = body.decode(charset).encode(charset) - except (UnicodeEncodeError, UnicodeDecodeError) as e: + body = body.encode(charset) + except UnicodeError as e: logger.error("Unicode error {0}".format(e)) body = body.encode(charset, 'replace') |