New submission from Alex Corcoles <a...@pdp7.net>:

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 word-wrapped. If they are, 
decode_header will return a string with newlines in it.

This is something which is unexpected for many people, and can cause bugs which 
are very difficult to detect in code review or testing, as it's easy to not 
trigger wordwrapping if not done deliberately.

We would humbly suggest to provide a friendly way to get an email's subject in 
the expected fashion (i.e. with no newlines) or point out this caveat in the 
docs (or maybe change decode_header to remove newlines itself).

Kind regards,

Álex

----------
components: email
messages: 327481
nosy: Alex Corcoles, barry, r.david.murray
priority: normal
severity: normal
status: open
title: Getting an email's subject is error-prone
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34954>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to