Skip to content

python 3.15 email.header Header() encoding name change in returned string. #153633

Description

@rouilj

Bug report

Bug description:

My test suite broke when it executed the equivalent of following:

from email.header import Header
print('%s' % Header(u'café', "iso8859-1").encode())

When this is run under python 3.10->3.14 it returns:

=?iso8859-1?q?caf=E9?=

but when run under python 3.15 it returns:

=?iso-8859-1?q?caf=E9?=

based on the CI output. I don't have a 3.15 local environment. I am interpreting the output as normalizing the encoding.

I have searched the release notes for 3.15 and didn't see anything that indicated Header would not use the supplied name for the charset. I also didn't see anything that indicated the iso8859-1 form was deprecated.

I can change the test case to use iso-8859-1 in place of iso8859-1, which returns the =?iso-8859-1?q?caf=E9?= output in all the python versions I support, but...

Is my search fu just bad or is this a bug/intended change?

Thanks.

-- rouilj

CPython versions tested on:

3.15

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    pendingThe issue will be closed if no feedback is providedstdlibStandard Library Python modules in the Lib/ directorytopic-emailtype-bugAn unexpected behavior, bug, or error

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions