[issue34954] Getting an email's subject is error-prone

2018-10-11 Thread Alex Corcoles
Alex Corcoles added the comment: Duh, I'm an idiot, I only tested policy.HTTP and *NOT* supplying a policy (which I believed was equivalent to using policy.default). policy.default and policy.SMTP do indeed produce a newline-less subject indeed. I only tested policy.HTTP because the docs

[issue34954] Getting an email's subject is error-prone

2018-10-11 Thread R. David Murray
R. David Murray added the comment: I'm guessing you got confused by the fact that the HTTP policy doesn't *add* new lines when *serializing*. If you can point to the part of the docs you read that produced that confusion, maybe we can improve it. --

[issue34954] Getting an email's subject is error-prone

2018-10-11 Thread R. David Murray
R. David Murray added the comment: Can you demonstrate that policy.default and policy.SMTP produce a subject with newlines? If they do, that is a serious bug. Please don't reopen the issue. I'll reopen it if you convince me there is a bug :) The statement you suggest we add is not

[issue34954] Getting an email's subject is error-prone

2018-10-11 Thread Alex Corcoles
Alex Corcoles added the comment: Well, I think that having to choose the "HTTP" policy to get a message subject's without newlines goes against the expectations of anyone who is not well knowledgeable of email. It's not very easy to deduct that, out of all the available policies, HTTP is

[issue34954] Getting an email's subject is error-prone

2018-10-10 Thread R. David Murray
R. David Murray added the comment: The new policies *make* the email library that higher level library, that was pretty much the whole point :) I don't know how to make getting the fully decoded subject more intuitive than: msg['subject'] The fact that you have to specify a policy is

[issue34954] Getting an email's subject is error-prone

2018-10-10 Thread Alex Corcoles
Alex Corcoles added the comment: To clarify (and maybe help someone which might come across), you mean: In [1]: message_text = """To: a...@corcoles.net ...: Subject: ** ACKNOWLEDGEMENT Host Alert: archerc7.bcn.int.pdp7.net is DOWN ...: ** ...: User-Agent: Heirloom mailx 12.5 7/5/10

[issue34954] Getting an email's subject is error-prone

2018-10-10 Thread R. David Murray
R. David Murray added the comment: Use the new email policies in python3. It handles all the decoding for you. I'm afraid you are on your own for python2. -- resolution: -> out of date stage: -> resolved status: open -> closed ___ Python

[issue34954] Getting an email's subject is error-prone

2018-10-10 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34954] Getting an email's subject is error-prone

2018-10-10 Thread Alex Corcoles
New submission from Alex Corcoles : Hi, This is something that has hit us a few times, as we write a significant quantity of software which parses email messages. The thing is, we use email.header.decode_header to decode the Subject: header and it is pretty common for headers to be