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 paulproteus
Recipients ThomasAH, barry, paulproteus, rdemetrescu
Date 2008-09-27.23:59:44
SpamBayes Score 1.13224e-08
Marked as misclassified No
Message-id <>
Another way to see this issue is that the email module double-encodes
when one attempts to use quoted-printable encoding.  This has to be
worked around by e.g. MoinMoin.

It's easy to get proper base64-encoded output of email.mime.text:

 	>>> mt = email.mime.text.MIMEText('Ta mère', 'plain', 'utf-8')
 	>>> 'Content-Transfer-Encoding: base64' in mt.as_string()
 	>>> mt.as_string().split('\n')[-2]

There we go, all nice and base64'd.

I can *not* figure out how to get quoted-printable-encoding.  I found , so I thought
great - I'll just encode my MIMEText object:

 	>>> email.encoders.encode_quopri(mt)
 	>>> 'Content-Transfer-Encoding: quoted-printable' in mt.as_string()

Great!  Except it's actually double-encoded, and the headers admit to as
much.  You see here that, in addition to the quoted-printable header
just discovered, there is also a base64-related header, and the result
is not strictly QP encoding but QP(base64(payload)).

 	>>> 'Content-Transfer-Encoding: base64' in mt.as_string()
 	>>> mt.as_string().split('\n')[-2]

It should look like:

 	>>> quopri.encodestring('Ta mère')
 	'Ta m=C3=A8re'

I raised this issue on the Baypiggies list
<>, but
luckily I found this here bug.  This is with Python 2.5.2-0ubuntu1 from
Ubuntu 8.04.

 	paulproteus@alchemy:~ $ python --version
 	Python 2.5.2

If we can come to a decision as to how this *should* work, I could
contribute a patch and/or tests to fix it.  I could even perhaps write a
new section of the Python documentation of the email module explaining this.
Date User Action Args
2008-09-27 23:59:47paulproteussetrecipients: + paulproteus, barry, ThomasAH, rdemetrescu
2008-09-27 23:59:47paulproteussetmessageid: <>
2008-09-27 23:59:46paulproteuslinkissue1525919 messages
2008-09-27 23:59:45paulproteuscreate