RE: [FO]: OB01 escape-uri

Oliver:
Thanks for your close reading if the spec.  Here is another crack at proposed wording.

7.4.10 fn:escape-uri
fn:escape-uri(	$uri-part	 as xs:string?,	
	$escape-reserved	 as xs:boolean) as xs:string	
Summary: This function applies the URI escaping rules defined in section 2 of [RFC 2396] <file:///C:\XMLSpecs\Query\FandO\Work\xpath-functions.html>  as amended by [RFC 2732] <file:///C:\XMLSpecs\Query\FandO\Work\xpath-functions.html> , with one exception, to the string supplied as $uri-part, which typically represents all or part of a URI. The effect of the function is to escape a set of identified characters in the string. 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. 
The set of characters that are escaped depends on the setting of the boolean argument $escape-reserved.
If $uri-part is the empty sequence, returns the zero-length string.
If $escape-reserved is true, all characters are escaped other than the lower case letters a-z, the upper case letters A-Z, the digits 0-9, the PERCENT SIGN "%" and the NUMBER SIGN "#" characters and the characters referred to in [RFC 2396] <file:///C:\XMLSpecs\Query\FandO\Work\xpath-functions.html>  as "marks": specifically, HYPHEN-MINUS ("-"), LOW LINE ("_"), FULL STOP ".", EXCLAMATION MARK "!", TILDE "~", ASTERISK "*", APOSTROPHE "'", LEFT PARENTHESIS "(", and RIGHT PARENTHESIS ")". 
If $escape-reserved is false, additional characters are added to the list of characters that are not escaped. These are the characters referred to in [RFC 2396] <file:///C:\XMLSpecs\Query\FandO\Work\xpath-functions.html>  and [RFC 2732] <file:///C:\XMLSpecs\Query\FandO\Work\xpath-functions.html>  as reserved characters, (See [Uniform Resource Identifiers (URI): Generic Syntax] <file:///C:\XMLSpecs\Query\FandO\Work\xpath-functions.html> ) and consist of the following: SEMICOLON ";", SOLIDUS "/", QUESTION MARK "?", COLON ":", COMMERCIAL AT "@", AMPERSAND "&", EQUALS SIGN "=", PLUS SIGN "+", DOLLAR SIGN "$", COMMA ",", NUMBER SIGN "#", LEFT SQUARE BRACKET "[" and RIGHT SQUARE BRACKET "]". 
[RFC 2396] <file:///C:\XMLSpecs\Query\FandO\Work\xpath-functions.html>  does not define whether escaped URIs should use lower case or upper case for hexadecimal digits. To ensure that escaped URIs can be compared using string comparison functions, this function must always generate hexadecimal values using the upper-case letters A-F.
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. 
7.4.10.1 Examples
*	fn:escape-uri ("http://www.example.com/00/Weather/CA/Los%20Angeles#ocean", true()) returns "http%3A%2F%2Fwww.example.com%2F00%2FWeather%2FCA%2FLos%20Angeles#ocean" 
*	fn:escape-uri ("http://www.example.com/00/Weather/CA/Los%20Angeles#ocean", false()) returns "http://www.example.com/00/Weather/CA/Los%20Angeles#ocean" 
*	fn:escape-uri ("http://www.example.com/~bébé", false()) returns "http://www.example.com/~b%C3%A9b%C3%A9" 


All the best, Ashok

-----Original Message-----
From: public-qt-comments-request@w3.org [mailto:public-qt-comments-request@w3.org] On Behalf Of Oliver Becker
Sent: Wednesday, December 17, 2003 4:52 AM
To: public-qt-comments@w3.org
Subject: RE: [FO]: OB01 escape-uri


Ashok Malhotra wrote:

> If $escape-reserved is false, all characters are escaped other than the 
> lower case letters a-z, the upper case letters A-Z, the digits 0-9, the 
> PERCENT SIGN "%" and the NUMBER SIGN "#" characters and the characters 
> referred to in [RFC 2396] as "marks": HYPHEN-MINUS ("-"), LOW LINE ("_"), 
> FULL STOP ".", EXCLAMATION MARK "!", TILDE "~", ASTERISK "*", APOSTROPHE 
> "'", LEFT PARENTHESIS "(", and RIGHT PARENTHESIS ")". 
>
> In addition, the characters referred to in [RFC 2396] and [RFC 2732] as 
> reserved characters, (See [Uniform Resource Identifiers (URI): Generic 
> Syntax]) are not escaped. These characters are: SEMICOLON ";", SOLIDUS "/", 
> QUESTION MARK "?", COLON ":", COMMERCIAL AT "@", AMPERSAND "&", EQUALS 
> SIGN "=", PLUS SIGN "+", DOLLAR SIGN "$", COMMA "," NUMBER SIGN "#", LEFT 
> SQUARE BRACKET "[" and RIGHT SQUARE BRACKET "]". 

- add a comma after COMMA ","
- The number sign "#" appears twice (it is already mentioned in the first
  paragraph)

Regards,  
Oliver Becker


/-------------------------------------------------------------------\
|  ob|do        Dipl.Inf. Oliver Becker                             |
|  --+--        E-Mail: obecker@informatik.hu-berlin.de             |
|  op|qo        WWW:    http://www.informatik.hu-berlin.de/~obecker |
\-------------------------------------------------------------------/

Received on Wednesday, 17 December 2003 12:53:02 UTC