Javascript Function: escape

Javascript 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 Jenni.”))
 
Output:
Miss%20Jenni.
 
Code:
document.write(escape(”!@#$%^&*()_+|”))
 
Output:
%21@%23%24%25%5E%26*%28%29_+%7C

Leave a Reply

You must be logged in to post a comment.


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.