unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Sam Steingold <sds@gnu.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 56824@debbugs.gnu.org
Subject: bug#56824: 29.0.50; mail-header-parse-address drops the 1st character from the name
Date: Fri, 29 Jul 2022 09:58:26 -0400	[thread overview]
Message-ID: <lzsfmkyq9p.fsf@3c22fb11fdab.ant.amazon.com> (raw)
In-Reply-To: <87edy4kpm3.fsf@gnus.org> (Lars Ingebrigtsen's message of "Fri, 29 Jul 2022 15:36:20 +0200")

> * Lars Ingebrigtsen <ynefv@tahf.bet> [2022-07-29 15:36:20 +0200]:
>
> Sam Steingold <sds@gnu.org> writes:
>
>> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=10406
>> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=56422
>>
>> Lars told me to use `mail-header-parse-address' instead of
>> `mail-extract-address-components'.
>
> Well, not exactly.

oops. sorry. ;-)

>> Well, I tried, with a positive effect (thanks Lars!),
>> but here is the 1st time the former is deficient:
>>
>> (mail-header-parse-addresses "Štěpán Němec <stepnem@gmail.com>")
>> ==> (("stepnem@gmail.com" . "těpán Němec"))
>> (mail-extract-address-components "Štěpán Němec <stepnem@gmail.com>")
>> ==> ("Štěpán Němec" "stepnem@gmail.com")
>
> `mail-header-parse-addresses' is for parsing RFC822bis mail addresses.
> "Štěpán Němec <stepnem@gmail.com>" is definitely not one of those.

Hmmm, it _used to be_
--8<---------------cut here---------------start------------->8---
"=?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= <stepnem@gmail.com>"
--8<---------------cut here---------------end--------------->8---
(is that what RFC822bis specifies?)

but was passed through `mail-decode-encoded-word-string':
--8<---------------cut here---------------start------------->8---
(mail-decode-encoded-word-string "=?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= <stepnem@gmail.com>")
==> "Štěpán Němec <stepnem@gmail.com>"
--8<---------------cut here---------------end--------------->8---
and then passed on to `mail-header-parse-addresses'.

What is TRT here?

Should I call `mail-header-parse-addresses' _first_ and then
`mail-decode-encoded-word-string'?
Come to think of it, passing _email address_ through
`mail-decode-encoded-word-string' seems unnecessary...

--8<---------------cut here---------------start------------->8---
(mail-header-parse-addresses "=?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= <stepnem@gmail.com>")
==> (("stepnem@gmail.com" . "=?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?="))
(mail-decode-encoded-word-string "=?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?=")
==> "Štěpán Němec"
--8<---------------cut here---------------end--------------->8---

> You're probably looking for `mail-header-parse-address-lax':
>
> (mail-header-parse-address-lax "Štěpán Němec <stepnem@gmail.com>")
> -> ("stepnem@gmail.com" . "Štěpán Němec")

... Or maybe I should keep the current order of processing and use
`mail-header-parse-address-lax'?

Thank you for your speedy and enlightening reply!

-- 
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.2113
http://childpsy.net http://calmchildstories.com http://steingoldpsychology.com
http://think-israel.org https://thereligionofpeace.com https://iris.org.il
In the race between idiot-proof software and idiots, the idiots are winning.





  reply	other threads:[~2022-07-29 13:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-29 13:31 bug#56824: 29.0.50; mail-header-parse-address drops the 1st character from the name Sam Steingold
2022-07-29 13:36 ` Lars Ingebrigtsen
2022-07-29 13:58   ` Sam Steingold [this message]
2022-07-30 11:46     ` Lars Ingebrigtsen
2022-07-30 11:47     ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=lzsfmkyq9p.fsf@3c22fb11fdab.ant.amazon.com \
    --to=sds@gnu.org \
    --cc=56824@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).