From c00e4115f5bd205a0f65224dccd5e889e7cbf3b8 Mon Sep 17 00:00:00 2001 From: Folker Bernitt Date: Mon, 10 Aug 2015 14:51:55 +0200 Subject: Fixed unit and integration tests. --- service/pixelated/adapter/mailstore/leap_mailstore.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'service/pixelated/adapter/mailstore') diff --git a/service/pixelated/adapter/mailstore/leap_mailstore.py b/service/pixelated/adapter/mailstore/leap_mailstore.py index 8831ae84..a641c35b 100644 --- a/service/pixelated/adapter/mailstore/leap_mailstore.py +++ b/service/pixelated/adapter/mailstore/leap_mailstore.py @@ -13,6 +13,7 @@ # # You should have received a copy of the GNU Affero General Public License # along with Pixelated. If not, see . +from email.header import decode_header from uuid import uuid4 from leap.mail.adaptors.soledad import SoledadMailAdaptor from twisted.internet import defer @@ -64,9 +65,13 @@ class LeapMail(Mail): @property def raw(self): - result = '' + result = u'' for k, v in self._headers.items(): - result += '%s: %s\n' % (k, v) + content, encoding = decode_header(v)[0] + if encoding: + result += '%s: %s\n' % (k, unicode(content, encoding=encoding)) + else: + result += '%s: %s\n' % (k, v) result += '\n' if self._body: -- cgit v1.2.3