Difference between revisions of "Ns urlencode"

From AOLserver Wiki
Jump to navigation Jump to search
(imported from WiKit id 924)
 
 
(One intermediate revision by one other user not shown)
Line 15: Line 15:
 
: This command encodes a string according to the rules for URL encoding defined in [http://www.faqs.org/rfcs/rfc1738.html RFC 1738, Uniform Resource Locators (URL)] and [http://www.faqs.org/rfcs/rfc2396.html RFC 2396, Uniform Resource Identifiers (URI): Generic Syntax].  Essentially, each non-alphanumeric byte is converted to its hexadecimal representation, prepended with a percent sign.
 
: This command encodes a string according to the rules for URL encoding defined in [http://www.faqs.org/rfcs/rfc1738.html RFC 1738, Uniform Resource Locators (URL)] and [http://www.faqs.org/rfcs/rfc2396.html RFC 2396, Uniform Resource Identifiers (URI): Generic Syntax].  Essentially, each non-alphanumeric byte is converted to its hexadecimal representation, prepended with a percent sign.
  
: The optional '''-charset''' ''charset'' parameter defines the character set of the encoded string.  If not specified, the default is "utf-8".  (Is this true?  The default is whatever the server's "urlcharset" is configured to, which in the sample-config.tcl may be UTF-8 or ISO-8859-1.)
+
: The optional '''-charset''' ''charset'' parameter defines the character set of the encoded string.  If not specified, then "utf-8" is used.  
  
 
'''EXAMPLES'''
 
'''EXAMPLES'''
Line 21: Line 21:
 
     % ns_urlencode http://www.aolserver.com/
 
     % ns_urlencode http://www.aolserver.com/
 
     http%3a%2f%2fwww%2eaolserver%2ecom%2f
 
     http%3a%2f%2fwww%2eaolserver%2ecom%2f
 +
 +
The character é ('e' accent acute) is unicode U+00E9
 +
    % ns_urlencode -charset utf8 \uE9
 +
    %c3%a9
 +
    % ns_urlencode -charset iso8859-1 \uE9
 +
    %e9
  
 
'''SEE ALSO'''
 
'''SEE ALSO'''
  
: [[ns_urldecode]], [[Discussion of ns_urlencode]]
+
: [[ns_urldecode]]
 
 
----
 
  
[[Category Documentation]] - [[Category Core Tcl API]]
+
[[Category:Documentation]]
 +
[[Category:Core Tcl API]]

Latest revision as of 11:05, 9 September 2007

Man page: http://aolserver.com/docs/tcl/ns_urlencode.html


NAME

ns_urlencode - Encode a string to its URL-encoded representation

SYNOPSIS

ns_urlencode ?-charset charset? data

DESCRIPTION

This command encodes a string according to the rules for URL encoding defined in RFC 1738, Uniform Resource Locators (URL) and RFC 2396, Uniform Resource Identifiers (URI): Generic Syntax. Essentially, each non-alphanumeric byte is converted to its hexadecimal representation, prepended with a percent sign.
The optional -charset charset parameter defines the character set of the encoded string. If not specified, then "utf-8" is used.

EXAMPLES

   % ns_urlencode http://www.aolserver.com/
   http%3a%2f%2fwww%2eaolserver%2ecom%2f

The character é ('e' accent acute) is unicode U+00E9

   % ns_urlencode -charset utf8 \uE9
   %c3%a9
   % ns_urlencode -charset iso8859-1 \uE9
   %e9

SEE ALSO

ns_urldecode