* Problems in parsing message's "From" header
@ 2009-06-22 7:56 Teemu Likonen
2009-06-22 10:58 ` Teemu Likonen
0 siblings, 1 reply; 2+ messages in thread
From: Teemu Likonen @ 2009-06-22 7:56 UTC (permalink / raw
To: emacs-devel
There's a small bug somewhere in parsing and handling messages' "From"
header. Here's some background information first. Function
mail-header-parse-address works like this:
(mail-header-parse-address "Teemu Likonen <tlikonen@iki.fi>")
=> ("tlikonen@iki.fi" . "Teemu Likonen")
But if there are some non-latin letters it fails to parse the name part,
for example:
(mail-header-parse-address "Γιώργος Σεφέρης <address@invalid>")
=> ("address@invalid")
If I put double quotes ("...") around the name it is parsed correctly:
(mail-header-parse-address "\"Γιώργος Σεφέρης\" <address@invalid>")
=> ("address@invalid" . "Γιώργος Σεφέρης")
Maybe this is a feature but there is a little problem anyway: I use my
own function to insert citation line when replying to a message with
Gnus. The function is defined through variable
message-citation-line-function. To get person's name and address I have
this in my custom citation function:
(mail-header-parse-address
(mail-header-from message-reply-headers))
Vector message-reply-headers has message's "From" field but person's
name is not enclosed in double quotes. Hence mail-header-parse-address
fails to parse the name.
So, is this bug or "non-ideal behaviour" (a) in the function
mail-header-parse-address (b) in the code which produces the vector
message-reply-headers or (c) in the code which puts the "From" field in
the buffer in the first place? About the item "c" I should add that in
Gnus's Article buffer there are no double quotes around person's name.
Thanks. I'm using up-to-date Emacs CVS/Git version:
GNU Emacs 23.1.50.3 (i686-pc-linux-gnu, GTK+ Version 2.12.12) of
2009-06-22 on mithlond
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Problems in parsing message's "From" header
2009-06-22 7:56 Problems in parsing message's "From" header Teemu Likonen
@ 2009-06-22 10:58 ` Teemu Likonen
0 siblings, 0 replies; 2+ messages in thread
From: Teemu Likonen @ 2009-06-22 10:58 UTC (permalink / raw
To: emacs-devel
On 2009-06-22 10:56 (+0300), Teemu Likonen wrote:
> But if there are some non-latin letters it fails to parse the name
> part, for example:
>
> (mail-header-parse-address "Γιώργος Σεφέρης <address@invalid>")
> => ("address@invalid")
OK, I found another function, mail-extract-address-components, which can
parse the above address string:
(mail-extract-address-components "Γιώργος Σεφέρης <address@invalid>")
=> ("Γιώργος Σεφέρης" "address@invalid")
So, my problem actually went away. It's probably time to say the usual
"sorry for the noise", from my part at least. :-)
The problem in mail-header-parse-address is probably valid anyway:
> (mail-header-parse-address
> (mail-header-from message-reply-headers))
>
> Vector message-reply-headers has message's "From" field but person's
> name is not enclosed in double quotes. Hence mail-header-parse-address
> fails to parse the name.
>
> So, is this bug or "non-ideal behaviour" (a) in the function
> mail-header-parse-address (b) in the code which produces the vector
> message-reply-headers or (c) in the code which puts the "From" field
> in the buffer in the first place? About the item "c" I should add that
> in Gnus's Article buffer there are no double quotes around person's
> name.
>
> Thanks. I'm using up-to-date Emacs CVS/Git version:
>
> GNU Emacs 23.1.50.3 (i686-pc-linux-gnu, GTK+ Version 2.12.12) of
> 2009-06-22 on mithlond
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-06-22 10:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-22 7:56 Problems in parsing message's "From" header Teemu Likonen
2009-06-22 10:58 ` Teemu Likonen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.