Subject: bug#56824: 29.0.50; mail-header-parse-address drops the 1st character from the name

From: Lars Ingebrigtsen <[email-masked]>
Date: Sat, 30 Jul 2022 13:46:40 +0200

Sam Steingold <[email-masked]> writes:

> Should I call `mail-header-parse-addresses' _first_ and then
> `mail-decode-encoded-word-string'?

Yup.  Or use the RAWP parameter to `mail-header-parse-addresses' and
then parse with `mail-header-parse-address' with a DECODE parameter.

>> You're probably looking for `mail-header-parse-address-lax':
>>
>> (mail-header-parse-address-lax "Štěpán Němec <[email-masked]>")
>> -> ("[email-masked]" . "Štěpán Němec")
>
> ... Or maybe I should keep the current order of processing and use
> `mail-header-parse-address-lax'?

No, that'll always be less reliable, because the -lax version uses
heuristics.  This makes a difference when the address is something weird
like the name part containing an @ character (like
"=?utf-8?Q?=40ndr=C3=A9?= <[email-masked]>" decoded to, "@ndré
<[email-masked]>" which is valid and appears in the wild).