W3C home > Mailing lists > Public > uri@w3.org > March 2003

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

From: Dan Connolly <connolly@w3.org>
Date: 14 Mar 2003 11:22:18 -0600
To: public-qt-comments@w3.org, Graham Klyne <GK@NineByNine.org>
Cc: uri@w3.org
Message-Id: <1047662532.25644.61.camel@dirk.dm93.org>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 13 January 2011 12:15:31 GMT