why the special case for % in fn:escape-uri?

I see:

6.4.19.1 Examples
      * fn:escape-uri
        ("gopher://spinaltap.micro.umn.edu/00/Weather/California/Los%20Angeles#ocean", true()) returns "gopher%3A%2F%2Fspinaltap.micro.umn.edu%2F00%2FWeather%2FCalifornia%2FLos%20Angeles%23ocean"


http://www.w3.org/TR/xquery-operators/#func-escape-uri

but the % after Los needs to be escaped, no?

i.e. the result should be ala...

>>> from urllib import quote
>>> s =
"gopher://spinaltap.micro.umn.edu/00/Weather/California/Los%20Angeles#ocean"
>>> quote(s, safe='')
'gopher%3A%2F%2Fspinaltap.micro.umn.edu%2F00%2FWeather%2FCalifornia%2FLos%2520Angeles%23ocean'

Note the ...Los%2520...


Hmm... the spec seems to special-case this:

  The "%" character itself is escaped only if it is not followed
  by two hexadecimal digits (that is, 0-9, a-f, and A-F)

I don't understand why.

Also... what does 'when escaping an entire URI or URI reference' refer
to?

Hmm... Graham, have you thought about a suite of tests for
URI escaping issues?


-- 
Dan Connolly, W3C http://www.w3.org/People/Connolly/

Received on Friday, 14 March 2003 12:21:11 UTC