Rex Dieter wrote:
> Rex Dieter wrote:
> > Michael Bäuerle wrote:
> > > 
> > > The problem is that the '-' character is used literally inside a regex
> > > bracket expression (where it has the meaning of a range, like in "a-z"),
> > > look at [3] (Paragraph 7) for the syntax definition.
> > > The resulting range spans over the '?' character and prevents its
> > > percent encoding.
> > 
> > Testing myself, I cannot reproduce the problem you describe.  Can you give
> > a reproducible example?
> > 
> > I tried:
> > 
> > xdg-email [email protected]
> > 
> > and my email client opens correctly (with [email protected] as expected,
> > instead of something percent-encoded as you suggested would happen).
> > 
> > Fwiw, it happens the same for me whether I include your suggested fix or
> > not.
> 
> My mail client testing this (thunderbird) was handling the percent-encoded 
> input for me :-/ 
> 
> After adding some extra debugging I do see that unpatched code was passing 
> on:
> mailto:rdieter%[email protected]
> 
> Which mail client(s) did you use that didnt handle this?

I got a report from a user where the "-" don't work with Thunderbird
on an Ubuntu system. Don't ask me why Thunderbird don't like it. And
yes, your example above is valid and it is the fault of Thunderbird to
not decode it correctly.

The reason why I reported the problem is that it's not the intent of
xdg-email to encode the '-' (the missing backslash). Letting awk
interpret the backslash as range breaks the encoding of some characters
inside the range that are not allowed to appear literally. And this is
a bug in xdg-email, see below.

I use claws-mail without a desktop environment. Therefore I have created
a 'xdg-email-hook.sh' script with the following content:
----------------------------------------------------------------------
#! /bin/sh
echo "xdg-email-hook: $1"
claws-mail $1
----------------------------------------------------------------------

The echo show me (without the backslash-patch):
----------------------------------------------------------------------
$ xdg-email --utf8 '[email protected]'
xdg-email-hook: mailto:rdieter%[email protected]
$ xdg-email --utf8 '[email protected]'
xdg-email-hook: mailto:[email protected]
----------------------------------------------------------------------
The first example is valid (as stated above), but the second is
invalid. Both ('-' and '?') are allowed to be part of the local-part of
an addr-spec according to RFC5322. But a literal '?' is not allowed to
be part of an URI (with this meaning) according to RFC2368.
As a result claws-mail correctly truncates the address and show
"rdieter" in the address field instead of "[email protected]".

With the backslash-patch it works as expected (and IMHO intended by the
authors of xdg-email because the '-' don't need percent encoding):
---------------------------------------------------------------------
$ xdg-email --utf8 '[email protected]'
xdg-email-hook: mailto:[email protected]
$ xdg-email --utf8 '[email protected]'
xdg-email-hook: mailto:rdieter%[email protected]
---------------------------------------------------------------------
That the '-' now works for the noted Thunderbird user too is a nice
side effect.

This example shows why the '?' is reserved by RFC2368 and must be
percent encoded:
---------------------------------------------------------------------
$ xdg-email --utf8 --subject 'test' '[email protected]'
xdg-email-hook: mailto:rdieter%[email protected]?subject=test
---------------------------------------------------------------------
_______________________________________________
xdg mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/xdg

Reply via email to