[xdg-email] Percent encoding problems

Rex Dieter rdieter at math.unl.edu
Sat Aug 23 07:10:24 PDT 2014


Next time, please file a bug.

For now, I think all of these issues are already fixed in 1.1.0-rc2 (and 
latest git), except for escaping the '-' character, which I will commit 
shortly.

Thanks.

-- Rex

Michael Bäuerle wrote:

> The reported version number is 1.0.2, the source package is named
> 1.1.0-rc1 for its toplevel directory.
> 
> The first thing is only a side note:
> The 'xdg-email' script request '/bin/sh' as interpreter,
> according to [1] it should do the comparison with "=" instead
> of "==" to be portable.
> 
> The real problem is the handling of e-mail addresses:
> If the address contains a '-', it is percent encoded (even if this is
> not required). But if it contains a '?' this stay a literal '?' (what
> is not allowed inside a "mailto:" URI according to [2]).
> 
> 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.
> 
> The suggested patches are attached. The '-' is escaped with a backslash.
> Maybe the solution from [3] to put it at the beginning or the end is
> cleaner but less obvious.
> In [3] there is also a note that ranges are only guaranteed to work as
> expected in the POSIX locale. Therefore the patch sets the locale to
> POSIX before starting awk.
> 
> 
> [1] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html
> [2] https://tools.ietf.org/html/rfc2368#section-2
> [3]
> 
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03_05




More information about the xdg mailing list