Skip to content
Snippets Groups Projects
Commit b5443dd3 authored by ale's avatar ale
Browse files

handle content-transfer-encoding: 8bit

parent ec981299
Branches
Tags
No related merge requests found
Pipeline #
...@@ -154,7 +154,7 @@ def encode_base64(msg): ...@@ -154,7 +154,7 @@ def encode_base64(msg):
# for multipart attachments (eg. 7bit or 8bit encoded attachments). For # for multipart attachments (eg. 7bit or 8bit encoded attachments). For
# now, if content is already encoded as base64 or if it is encoded with # now, if content is already encoded as base64 or if it is encoded with
# some unknown encoding, we just pass. # some unknown encoding, we just pass.
if encoding in [None, 'quoted-printable', 'x-uuencode', 'uue', 'x-uue']: if encoding in [None, 'quoted-printable', 'x-uuencode', 'uue', 'x-uue', '8bit']:
orig = msg.get_payload(decode=True) orig = msg.get_payload(decode=True)
encdata = _bencode(orig) encdata = _bencode(orig)
msg.set_payload(encdata) msg.set_payload(encdata)
......
...@@ -181,9 +181,14 @@ class TestMIME(TestBase): ...@@ -181,9 +181,14 @@ class TestMIME(TestBase):
def test_simple_text_message(self): def test_simple_text_message(self):
self._encrypt(MIMEText('test message')) self._encrypt(MIMEText('test message'))
def test_utf8_text_message(self): def test_base64_text_message(self):
self._encrypt(MIMEText(u'test message', 'plain', 'utf-8')) self._encrypt(MIMEText(u'test message', 'plain', 'utf-8'))
def test_8bit_text_message(self):
m = MIMEText(u'test message')
m.replace_header('Content-Transfer-Encoding', '8bit')
self._encrypt(m)
def test_multipart_message_with_image(self): def test_multipart_message_with_image(self):
msg = MIMEMultipart() msg = MIMEMultipart()
msg.preamble = 'This is a message with an image attachment' msg.preamble = 'This is a message with an image attachment'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment