W3C home > Mailing lists > Public > public-qt-comments@w3.org > April 2005

[Bug 1243] New: fn:escape-uri needs to be invertible in the true() case; take out the % exception

From: <bugzilla@wiggum.w3.org>
Date: Tue, 12 Apr 2005 19:43:17 +0000
To: public-qt-comments@w3.org
Message-Id: <E1DLRI5-0004rb-5S@wiggum.w3.org>


           Summary: fn:escape-uri needs to be invertible in the true() case;
                    take out the % exception
           Product: XPath / XQuery / XSLT
           Version: Last Call drafts
          Platform: PC
               URL: http://lists.w3.org/Archives/Public/public-qt-
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Functions and Operators
        AssignedTo: ashok.malhotra@oracle.com
        ReportedBy: cmsmcq@w3.org
         QAContact: public-qt-comments@w3.org
                CC: connolly@w3.org

[posted in Bugzilla by cmsmcqW3.org on behalf of Dan Connolly;
text below is copied from his note to qt-comments.]


"Generally, $escape-reserved should be set to true when escaping a
string that is to form a single part of a URI, and to false when
escaping an entire URI or URI reference."

Indeed, those are the two relevant tasks. I might prefer
separate functions, as the tasks are quite unrelated.
In any case, the exception for the % character makes this
function unsuitable for the task of "form[ing] a single part of a URI".

As specified, fn:escape-uri("gross %each") returns "gross%20%each"
but that doesn't actually encode the string "gross %each" into
part of a URI such that the party that encoded it can decode it
again. In order to be useful, it needs to return
'gross%20%25each' . It needs to be invertible.

i.e. XQuery should follow all the other programming languages
out there, such as

- python

>>> urllib.quote("gross %each")

- perl

perl -e 'use URI::Escape; print uri_escape("gross %each"), "\n"'


- javascript


I can't find the standard library functions for Java and C#
with a few minutes of googling, but I'll bet they work likewise.

p.s. yes, this is essentially the same comment I made back in 2003.
Received on Tuesday, 12 April 2005 19:43:17 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:23 UTC