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
{{ message }}
Repository navigation
email.utils.encode_rfc2231() writes 'None' as the charset when only language is given #161222
email.utils.encode_rfc2231() substitutes an empty string when language is omitted, but not when charset is omitted. When only language is given, None is interpolated into the result as the literal charset name:
RFC 2231 section 4 says "it is perfectly permissible to leave either the character set or language field blank", so the expected result is "'en'abc". The email package's own parser reads the value back correctly only because None is not a known codec, so it falls back to the undecoded text. Other consumers see a bogus charset name.
This is separate from gh-85014, which covers the case where both charset and language are None.
Activity