[issue30032] email module creates base64 output with incorrect line breaks

2017-04-10 Thread R. David Murray
R. David Murray added the comment: There is, however, an issue that if you pass a message with the default policy to the generator and specify SMTP as the policy, it doesn't *recode* the line endings. I thought there was an open issue for that, but I can't find it. One solution would be to

[issue30032] email module creates base64 output with incorrect line breaks

2017-04-10 Thread R. David Murray
R. David Murray added the comment: Huh. I ran something like that test and thought I saw the reverse. I guess I misread my terminal. Looking at the code, set_content does take care to fix the line ending according to the policy before doing the encoding. -- resolution: -> out of

[issue30032] email module creates base64 output with incorrect line breaks

2017-04-10 Thread Jon Ribbens
Jon Ribbens added the comment: So on further investigation, with the new API and policy=SMTP, it does generate correct base64 output. So I guess on the basis that the new version can generate the right output, and it appears to be a deliberate choice that the default policy breaks the RFCs,

[issue30032] email module creates base64 output with incorrect line breaks

2017-04-10 Thread R. David Murray
Changes by R. David Murray : -- components: +email ___ Python tracker ___ ___

[issue30032] email module creates base64 output with incorrect line breaks

2017-04-10 Thread R. David Murray
Changes by R. David Murray : -- versions: -Python 2.7 ___ Python tracker ___ ___

[issue30032] email module creates base64 output with incorrect line breaks

2017-04-10 Thread R. David Murray
R. David Murray added the comment: That is true for text/ types, yes. The policy is named after the target wire protocol, and if you are transmitting an email message over SMTP, that implies MIME. What to do if you are not sending it over SMTP, though, is a tougher question. One could

[issue30032] email module creates base64 output with incorrect line breaks

2017-04-10 Thread Jon Ribbens
Jon Ribbens added the comment: OK cool, but please note that this is a MIME issue not an SMTP issue - if the message has text that is being base64-encoded then it must use CRLF line breaks regardless of whether SMTP is involved or not. -- ___

[issue30032] email module creates base64 output with incorrect line breaks

2017-04-10 Thread R. David Murray
R. David Murray added the comment: Actually, I think the fix would go in the generator, not in the contentmanager, but it's been long enough since I've worked on the code that I'm not sure. -- ___ Python tracker

[issue30032] email module creates base64 output with incorrect line breaks

2017-04-10 Thread R. David Murray
R. David Murray added the comment: This appears to be a problem in the new API as well. I don't think we can change the legacy API because its been that way forever and applications might be depending on it (that is, the library preserves exactly what it is handed, and an application might

[issue30032] email module creates base64 output with incorrect line breaks

2017-04-10 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- components: +email nosy: +barry, r.david.murray ___ Python tracker ___

[issue30032] email module creates base64 output with incorrect line breaks

2017-04-10 Thread Jon Ribbens
New submission from Jon Ribbens: 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