diff options
author | Ivan Alejandro <ivanalejandro0@gmail.com> | 2013-10-21 13:52:45 -0300 |
---|---|---|
committer | Ivan Alejandro <ivanalejandro0@gmail.com> | 2013-10-21 13:52:45 -0300 |
commit | c51294dd7c054850a195c526ab50c2cddf085d29 (patch) | |
tree | 0eff8883fdbd26369f31788c4725f46f216b4afb | |
parent | 2340415242569db4b54a4e6d2ebd2c8c3076bf7c (diff) | |
parent | cc40023ca0498609c37d37d42fa21e822e15dc6b (diff) |
Merge remote-tracking branch 'chiiph/bug/default_to_utf8' into develop
-rw-r--r-- | mail/changes/bug_default_to_utf8 | 2 | ||||
-rw-r--r-- | mail/src/leap/mail/imap/server.py | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/mail/changes/bug_default_to_utf8 b/mail/changes/bug_default_to_utf8 new file mode 100644 index 00000000..898138b5 --- /dev/null +++ b/mail/changes/bug_default_to_utf8 @@ -0,0 +1,2 @@ + o Default to UTF-8 when there is no charset parsed from the mail + contents.
\ No newline at end of file diff --git a/mail/src/leap/mail/imap/server.py b/mail/src/leap/mail/imap/server.py index 10d338a1..df510ce4 100644 --- a/mail/src/leap/mail/imap/server.py +++ b/mail/src/leap/mail/imap/server.py @@ -711,6 +711,8 @@ class LeapMessage(WithMsgFields): # Miniparser for: Content-Type: <something>; charset=<charset> charset_re = r'''charset=(?P<charset>[\w|\d|-]*)''' charset = re.findall(charset_re, em["Content-Type"])[0] + if charset is None or len(charset) == 0: + charset = "UTF-8" except Exception: pass return charset |