Message291434
The email module, when creating base64-encoded text parts, does not process line breaks correctly - RFC 2045 s6.8 says that line breaks must be converted to CRLF before base64-encoding, and the email module is not doing this.
>>> from email.mime.text import MIMEText
>>> import base64
>>> m = MIMEText("hello\nthere", _charset="utf-8")
>>> m.as_string()
'Content-Type: text/plain; charset="utf-8"\nMIME-Version: 1.0\nContent-Transfer-Encoding: base64\n\naGVsbG8KdGhlcmU=\n'
>>> base64.b64decode("aGVsbG8KdGhlcmU=")
b'hello\nthere'
You might say that it is the application's job to convert the line endings before calling MIMEText(), but I think all application authors would be surprised by this. Certainly the MailMan authors would be, as they say this is a Python bug not a MailMan bug ;-) |
|
Date |
User |
Action |
Args |
2017-04-10 17:41:26 | jribbens | set | recipients:
+ jribbens |
2017-04-10 17:41:26 | jribbens | set | messageid: <1491846086.02.0.299208621231.issue30032@psf.upfronthosting.co.za> |
2017-04-10 17:41:25 | jribbens | link | issue30032 messages |
2017-04-10 17:41:25 | jribbens | create | |
|