homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author cancel
Recipients barry, cancel, r.david.murray
Date 2012年06月20日.10:38:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1340188711.86.0.286169814605.issue15115@psf.upfronthosting.co.za>
In-reply-to
Content
Here is the test script:
--------------
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email import encoders
msg = MIMEMultipart()
msg['Subject'] = 'Bug test'
text_part = MIMEText('actual content doesnt matter')
text_part.set_charset('utf-8')
msg.attach(text_part)
xml_part = MIMEText(b'<xml>aaa</xml>')
xml_part.set_type('text/xml')
xml_part.set_charset('utf-8')
encoders.encode_base64(xml_part)
msg.attach(xml_part)
print(msg.as_string())
--------------------------
It prints the following:
--------------------------
Content-Type: multipart/mixed; boundary="===============2584752675366770986=="
MIME-Version: 1.0
Subject: Bug test
--===============2584752675366770986==
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="utf-8"
actual content doesnt matter
--===============2584752675366770986==
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
Content-Type: text/xml; charset="utf-8"
Content-Transfer-Encoding: base64
PHhtbD5hYWE8L3htbD4=
-ひく-ひく===============2584752675366770986==--
--------------------------
And that's incorrect: the header "Content-Transfer-Encoding" set twice. As workaround you can use:
del xml_part['Content-Transfer-Encoding']
History
Date User Action Args
2012年06月20日 10:38:32cancelsetrecipients: + cancel, barry, r.david.murray
2012年06月20日 10:38:31cancelsetmessageid: <1340188711.86.0.286169814605.issue15115@psf.upfronthosting.co.za>
2012年06月20日 10:38:31cancellinkissue15115 messages
2012年06月20日 10:38:30cancelcreate

AltStyle によって変換されたページ (->オリジナル) /