AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs
urlEncode (String str [, int ietf]) yoix.string
 
Translates each character in str to either x-www-mime-urlencoded (e.g., as used by Java) or IETF RFC 2396 (e.g., as used by perl). The latter encoding is used when ietf is present and non-zero. The x-www-mime-urlencoded encoding can be described as follows: each space is converted to a plus (+) character and all non-alphanumerics except for the underscore, dash, period and asterisk (i.e., all characters not part of the set [a-zA-Z0-9_.*-]) are converted into the percent character (%) followed by two hexadecimal digits representing the character. This x-www-mime-urlencoded encoding should be familiar to web users. The IETF RFC 2396 encoding is similar and is described at the ietf.org website. Roughly the difference is that this latter encoding uses a hexadecimal encoding for the space character rather than a plus (+) character and it leaves a larger number of non-alphanumerics unencoded.
 
 Example:   The program,
import yoix.string.*;

String enc = urlEncode("Hello, World.");

stdout.nextline = enc;
stdout.nextline = urlDecode(enc);
prints
Hello%2C+World.
Hello, World.
on standard output.
 
 Return:   String
 
 See Also:   urlDecode

 

Yoix is a registered trademark of AT&T Inc.