From da4d5015c0e31c565d143fe52d76dacdc65a0933 Mon Sep 17 00:00:00 2001 From: Folker Bernitt Date: Wed, 7 Oct 2015 14:24:30 +0200 Subject: Make unicode string explicit - Issue #473 - problem had been caused by auto-convert of str to unicode --- service/pixelated/adapter/mailstore/body_parser.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'service/pixelated/adapter/mailstore/body_parser.py') 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 -- cgit v1.2.3