summaryrefslogtreecommitdiff
path: root/service/pixelated/adapter/mailstore/body_parser.py
diff options
context:
space:
mode:
authorFolker Bernitt <fbernitt@thoughtworks.com>2015-10-07 14:24:30 +0200
committerFolker Bernitt <fbernitt@thoughtworks.com>2015-10-07 14:24:30 +0200
commitda4d5015c0e31c565d143fe52d76dacdc65a0933 (patch)
tree8bbdb60a1e199f5212861ca3ca480b1b97f0501a /service/pixelated/adapter/mailstore/body_parser.py
parentf33fd98fa4b60142174302d9186082bf04b9749f (diff)
Make unicode string explicit
- Issue #473 - problem had been caused by auto-convert of str to unicode
Diffstat (limited to 'service/pixelated/adapter/mailstore/body_parser.py')
-rw-r--r--service/pixelated/adapter/mailstore/body_parser.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/service/pixelated/adapter/mailstore/body_parser.py b/service/pixelated/adapter/mailstore/body_parser.py
index 364f9d25..a632319e 100644
--- a/service/pixelated/adapter/mailstore/body_parser.py
+++ b/service/pixelated/adapter/mailstore/body_parser.py
@@ -49,13 +49,13 @@ class BodyParser(object):
return parsed_body.get_payload(decode=True)
def _serialize_for_parser(self, charset):
- text = ''
- text += 'Content-Type: %s\n' % self._content_type
+ text = u''
+ text += u'Content-Type: %s\n' % self._content_type
if self._content_transfer_encoding is not None:
- text += 'Content-Transfer-Encoding: %s\n' % self._content_transfer_encoding
- text += '\n'
+ text += u'Content-Transfer-Encoding: %s\n' % self._content_transfer_encoding
+ text += u'\n'
+ encoded_text = text.encode(charset)
if isinstance(self._content, unicode):
- text = text.encode(charset) + self._content.encode(charset)
+ return encoded_text + self._content.encode(charset)
else:
- text += self._content
- return text
+ return encoded_text + self._content