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 calimeroteknik
Recipients barry, calimeroteknik, r.david.murray
Date 2017-10-21.13:49:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I confirm that as for the crash, the patch in gh-3488 fixes it.
The first code excerpt in my initial report now outputs the following, valid headers:

Content-Type: text/plain
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
MIME-Version: 1.0

However, when Unicode is added and the filename is short, things don't look right, this code:

import email.message
mail = email.message.EmailMessage()
mail.add_attachment(b"test", maintype="text", subtype="plain", filename="é.txt")

Results in these headers:

Content-Type: text/plain
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="é.txt"
MIME-Version: 1.0

To begin with, it is easy to deduce that there is no way to know that this 'é' character is UTF-8.
And it's two 8-bit values at east one of which is detectably outside of 7-bit US-ASCII.

>a lightweight encoding mechanism is needed to accommodate 8-bit information in parameter values.

The 8-bit encoding goes straight through instead of undergoing the encoding process, which seems required in my interpretation of RFC2231.
Date User Action Args
2017-10-21 13:49:54calimerotekniksetrecipients: + calimeroteknik, barry, r.david.murray
2017-10-21 13:49:54calimerotekniksetmessageid: <>
2017-10-21 13:49:54calimerotekniklinkissue31831 messages
2017-10-21 13:49:54calimeroteknikcreate