summaryrefslogtreecommitdiff
path: root/alot/helper.py
diff options
context:
space:
mode:
authorLucas Hoffmann <l-m-h@web.de>2017-08-21 23:20:42 +0200
committerLucas Hoffmann <l-m-h@web.de>2017-08-21 23:23:41 +0200
commitf475b96685686cb1f5597ac063de950f4efb0c85 (patch)
treeb9488e14ae0043245d5ddc95ac6791c58671a140 /alot/helper.py
parent6ee21b330d369cc91a9ba99eb2ee010e9e19e624 (diff)
Use cStringIO.StringIO to fix #1132
This undoes a small subset of the changes from fa3dd1b04567c4ea03fa658c3838b569531c79f5 and thus fixes #1132. The io.BytesIO object was not able to handle the unicode header names that where returned by envelope.construct_mail, which in turn did just copy them from the envelope header.
Diffstat (limited to 'alot/helper.py')
-rw-r--r--alot/helper.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/alot/helper.py b/alot/helper.py
index ce307875..1c569a23 100644
--- a/alot/helper.py
+++ b/alot/helper.py
@@ -10,6 +10,7 @@ from datetime import timedelta
from datetime import datetime
from collections import deque
from io import BytesIO
+from cStringIO import StringIO
import logging
import mimetypes
import os
@@ -606,7 +607,7 @@ def email_as_string(mail):
:param mail: email to convert to string
:rtype: str
"""
- fp = BytesIO()
+ fp = StringIO()
g = Generator(fp, mangle_from_=False, maxheaderlen=78)
g.flatten(mail)
as_string = RFC3156_canonicalize(fp.getvalue())