summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2013-10-21 13:52:45 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2013-10-21 13:52:45 -0300
commitdd8b6212072bb8db499e12468d9905a5cf8ce630 (patch)
tree13ced370d5b47d95039e41fa455da707739a3d18
parentb13bcda9e58a65102b9de72d36b95ade7178fd2c (diff)
parent8fdaf603e313b9cb938f2f41713862e75f40d583 (diff)
Merge remote-tracking branch 'chiiph/bug/default_to_utf8' into develop
-rw-r--r--changes/bug_default_to_utf82
-rw-r--r--src/leap/mail/imap/server.py2
2 files changed, 4 insertions, 0 deletions
diff --git a/changes/bug_default_to_utf8 b/changes/bug_default_to_utf8
new file mode 100644
index 0000000..898138b
--- /dev/null
+++ b/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/src/leap/mail/imap/server.py b/src/leap/mail/imap/server.py
index 10d338a..df510ce 100644
--- a/src/leap/mail/imap/server.py
+++ b/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