W3C home > Mailing lists > Public > public-qt-comments@w3.org > December 2003

RE: [FO]: OB01 escape-uri

From: Kay, Michael <Michael.Kay@softwareag.com>
Date: Wed, 10 Dec 2003 20:44:54 +0100
Message-ID: <DFF2AC9E3583D511A21F0008C7E62106073DD332@daemsg02.software-ag.de>
To: Ashok Malhotra <ashokma@microsoft.com>, Oliver Becker <obecker@informatik.hu-berlin.de>, public-qt-comments@w3.org

fn:escape-uri ("http://www.example.com/~bébé", true()) 
returns "http://www.example.com/%7Eb%E9b%E9" 

 
This one is wrong, unfortunately. The correct answer is (I believe) 

http%3A%2F%2Fwww.example.com%2F~b%C3%A9b%C3%A9

A better example is fn:escape-uri ("http://www.example.com/~bébé", false())

which returns

http://www.example.com/~b%C3%A9b%C3%A9

Note (a) that the characters are converted to UTF-8 octets, and then
hex-encoded, and (b) tilde is in the list of characters that aren't escaped,
whatever the setting of the second argument.

This also means that your sentence:

Each such character is replaced in the string by an escape sequence of the
form %HH, where HH is the hexadecimal representation of the octets used to
represent the character in UTF-8. 

would be better written as:

Each such character is replaced in the string by an escape sequence, which
is formed by encoding the character as a sequence of octets in UTF-8, and
then representing each of these octets in the form %HH, where HH is the
hexadecimal representation of the octet.


Michael Kay 
Received on Wednesday, 10 December 2003 14:46:31 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:14:03 GMT