[issue32298] Email.quopriprime over-encodes characters

R. David Murray report at bugs.python.org
Tue Dec 12 21:54:11 EST 2017


R. David Murray <rdmurray at bitdance.com> added the comment:

And of course tools can grep for "foo at bar.com": you can't use encoded words in an address, only in the display name.

However, it occurs to me that in fact the restriction applies only to phrases, so one could use a less restrictive character set in an unstructured header such as the Subject, and that would indeed be nice.  The old header folder (python 2.7 and python 3.x compat32 policy) can't do it, because they don't know anything about the syntax of the headers they fold, they just use a bunch of heuristics.  The new policies in python3, however, use a smarter folder from _header_value_parser, and that *does* have access to the full parse tree for the header, and so could make smart decisions about which character set to use for the encoded word encoding.

If you'd like to try your hand at a PR implementing this idea, I'll be happy to provide advice and do a review.  It's not going to be anywhere near as simple as the one line change you proposed here, though :)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32298>
_______________________________________


More information about the Python-bugs-list mailing list