Function:
escape
escape(string)
The top-level function, escape, encodes the string that is
contained in the string argument to make it portable. A string
is considered portable if it can be transmitted across any network to
any computer that supports ASCII characters.
To make a string portable, characters other than the following 69
ASCII characters must be encoded:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyz
1234567890
@*-_+./
All other characters are converted either to their two digit (%xx) or
four digit (%uxxxx) hexadecimal equivalent (refered to as the character's
"hexadecimal escape sequence"). For example, a blank space will be represented
by %20 and a semicolon by %3B. (Note that the hexadecimal numbers are:
0123456789ABCDEF).
Use the unescape function to decode
an encoded sequence that was created using escape.
Code:
document.write(escape("Miss Piggy."))
Output:
Miss%20Piggy.
Code:
document.write(escape("!@#$%^&*()_+|"))
Output:
%21@%23%24%25%5E%26*%28%29_+%7C
|