Ns urlencode

From AOLserver Wiki
Jump to: navigation, search

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