This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients andrewnester, barry, pi314159, r.david.murray
Date 2017-03-02.16:39:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1488472744.21.0.493515447412.issue29678@psf.upfronthosting.co.za>
In-reply-to
Content
Thanks for the response, but I do not believe that this is a bug.

The python3 email package will decode the headers automatically if you use the new policies, so if you iterate through the headers, you'll get the decoded versions, with access to the parms dict for each.  (For custom headers you will have to register the appropriate header parser, but it should automatically handle all the standard mime headers.)

For the compat32 policy (which is the default), there is indeed no easy way to do the same, but that isn't a bug, because any header that contains parameters (MIME headers) is supposed to be unique.

As for the stackoverflow question, see above for the RFC 2231 issue (the headers are unique).  For doing RFC 2047, decode_header does that.  With the compat32 policy it is awkward, but documented, how to apply the functions in the header submodule to decode an arbitrary string.  For the new policies you don't have to think about it; as I said above the decoding is done automatically (all unknown headers are treated as unstructured and rfc2047 decoding is done automatically).
History
Date User Action Args
2017-03-02 16:39:04r.david.murraysetrecipients: + r.david.murray, barry, andrewnester, pi314159
2017-03-02 16:39:04r.david.murraysetmessageid: <1488472744.21.0.493515447412.issue29678@psf.upfronthosting.co.za>
2017-03-02 16:39:04r.david.murraylinkissue29678 messages
2017-03-02 16:39:04r.david.murraycreate