summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2014-01-27 15:33:44 -0300
committerTomás Touceda <chiiph@leap.se>2014-01-27 15:33:44 -0300
commit781bd2f4d2a047088d1a0ecd673a38c80ea0c0c0 (patch)
tree60f2a30837176ea3fa567d95ab35deba84cff794 /src
parenta49b005d2a584936f364192864b6758bb1dd1215 (diff)
parent17ea6fd404fd606c74776dc05ce769a7df43569a (diff)
Merge remote-tracking branch 'refs/remotes/ivan/feature/improve-unicode-logs' into develop
Diffstat (limited to 'src')
-rw-r--r--src/leap/mail/imap/messages.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/leap/mail/imap/messages.py b/src/leap/mail/imap/messages.py
index 5bb5f1c..34304ea 100644
--- a/src/leap/mail/imap/messages.py
+++ b/src/leap/mail/imap/messages.py
@@ -178,10 +178,11 @@ class MessagePart(object):
logger.debug("Got charset from header: %s" % (charset,))
if charset is None:
charset = self._get_charset(payload)
+ logger.debug("Got charset: %s" % (charset,))
try:
payload = payload.encode(charset)
except (UnicodeEncodeError, UnicodeDecodeError) as e:
- logger.error("Unicode error {0}".format(e))
+ logger.error("Unicode error, using 'replace'. {0!r}".format(e))
payload = payload.encode(charset, 'replace')
fd.write(payload)
@@ -530,7 +531,7 @@ class LeapMessage(fields, MailParser, MBoxParser):
try:
body = body.encode(charset)
except UnicodeError as e:
- logger.error("Unicode error {0}".format(e))
+ logger.error("Unicode error, using 'replace'. {0!r}".format(e))
body = body.encode(charset, 'replace')
# We are still returning funky characters from here.