xf:escape-uri() issues

On the EXSLT list, regarding proposed changes to the EXSLT functions
for URI escaping, Michael Kay wrote:

> I would suggest quite strongly that if you do an escape-uri function in
> EXSLT, you base it on the proposed XPath 2.0 spec. If you think there's
> something badly wrong with the XPath 2.0 spec, then please say so on the
> public comments list so we can fix it.

OK then, regarding http://www.w3.org/TR/xquery-operators/#func-escape-uri ,

1. RFC 2396 is mentioned, but RFC 2732 is not. RFC 2732 adds "[" and "]" to
the set of reserved characters and changes the "host" part of the URI 
grammar, to allow IPv6 addresses.

2. I make a case for supporting encodings other than UTF-8 at
http://lists.fourthought.com/pipermail/exslt/2002-October/000658.html

In the EXSLT proposal, I suggest using an empty string for an encoding
name (in an optional final argument) to indicate how non-ASCII characters
are to be converted to octets. Note that ASCII characters are escaped
based on US-ASCII, so if you needed to use UTF-16BE, for example, " " would
still be "%20" while U+1234 would be "%12%34".

3. IRIs are not supported. In an IRI, the ASCII characters that would be
escaped in a URI are still escaped, but non-ASCII characters are not escaped
(forgive me if that's an overstatement). In the EXSLT proposal, I suggest
using an empty string for an encoding name (in an optional final argument) to
indicate that non-ASCII characters are not to be escaped.

4. I prefer the function name "uri-escape" over "escape-uri", as the former
implies a type of action (URI-style escaping of something), and the latter
implies an action on a subject (some kind of escaping of a URI), which would
be more accurate.

> By all means provide extensions beyond that if you think they're justified,
> e.g. support for encodings other than UTF-8, and support for unescaping, but
> the XPath 2.0 spec should be your baseline.

I have updated the proposal at http://skew.org/exslt-drafts/ accordingly,
highlighting the differences between the proposed EXSLT function and the
current xf:escape-uri().

   - Mike
____________________________________________________________________________
  mike j. brown                   |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  resume: http://skew.org/~mike/resume/

Received on Monday, 21 October 2002 04:35:17 UTC