You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add email.header.decode_header_to_string() convenience function
This function takes an email header, possibly with portions encoded
according to RFC2047, and converts it to a standard Python string.
It is intended to provide a sane, Pythonic replacement for
`email.header.decode_header()`, which has two major problems:
1. May return either bytes or str (bpo-22833/gh-67022), an
inconsistent and error-prone interface
2. Exposes details of an email header value's encoding which
most users will not care about or want to deal with. Many users
likely just want to decode an email header value to a Python
string.
It turns out that `email.header` already contained most of the code
necessary to do this, and providing `decode_header_to_string` as a
documented wrapper function points users in the right direction.
0 commit comments