Ns urldecode

From AOLserver Wiki
Revision as of 10:49, 9 September 2007 by Bernhard (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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


NAME

ns_urldecode - URL decoding

SYNOPSIS

ns_urldecode ?-charset charset? data

DESCRIPTION

This command decodes a string according to the rules for URL encoding defined in RFC 1738, Uniform Resource Locators (URL). 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".

EXAMPLES

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

The character é lowercase 'e' accent is represented by the byte e9 in iso8859-1 but in utf-8 by the two bytes c3 and a9.

   % ns_urldecode -charset iso8859-1 %e9
   % é
   % ns_urldecode -charset utf-8 %c3%a9
   % é

Using the wrong charset may lead to errors. If one (two byte) utf-8 character was decoded using iso8859-1 it would result in two incorrect characters.

   % ns_urldecode -charset iso8859-1 %c3%a9
   % é

SEE ALSO

ns_urlencode

Category Documentation - Category Core Tcl API