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.

classification
Title: Inconsistent behavior of email.header.decode_header
Type: behavior Stage: resolved
Components: email Versions:
process
Status: closed Resolution: duplicate
Dependencies: Superseder: email.header.decode_header return type is not consistent
View: 24797
Assigned To: Nosy List: SilentGhost, barry, louis.abraham@yahoo.fr, r.david.murray
Priority: normal Keywords:

Created on 2019-06-03 08:52 by louis.abraham@yahoo.fr, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (4)
msg344392 - (view) Author: Louis Abraham (louis.abraham@yahoo.fr) Date: 2019-06-03 08:52
Hi,

(this is my first issue btw)

I think <https://docs.python.org/3/library/email.header.html#email.header.decode_header> has a broken behavior.

It returns a list of `(decoded_string, charset)` pairs. However, `decoded_string` can be either a string or bytes.
I have no preference but it should really be of one type.
msg344396 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2019-06-03 09:30
This seem like a duplicate of #24797. I hope the answer given there applies.
msg344400 - (view) Author: Louis Abraham (louis.abraham@yahoo.fr) Date: 2019-06-03 10:08
Indeed, this is exactly the same (I should have researched more, my bad).

The problem is that I'm using mailbox.Maildir which uses the Compat32 API.

Do you think I should create an issue for Maildir to support the new EmailMessage API?
msg344439 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2019-06-03 16:09
There seems to be some work started in #32975. Perhaps, you'd like to revive it or contribute otherwise?
History
Date User Action Args
2022-04-11 14:59:16adminsetgithub: 81320
2019-06-03 16:09:16SilentGhostsetmessages: + msg344439
2019-06-03 10:08:43louis.abraham@yahoo.frsetmessages: + msg344400
2019-06-03 09:30:24SilentGhostsetstatus: open -> closed

superseder: email.header.decode_header return type is not consistent
type: behavior
components: + email

nosy: + barry, r.david.murray, SilentGhost
messages: + msg344396
resolution: duplicate
stage: resolved
2019-06-03 08:52:55louis.abraham@yahoo.frcreate