1. escape Method
Encode String objects so that they can be read on all computers,
Escape (charString)
The required charstring parameter is any String object or text to be encoded.
Note:
The escape method returns a string containing the charstring content (in Unicode format ). All spaces, punctuation marks, and accents are replaced by % xx encoding and other non-ASCII characters. xx indicates the hexadecimal number of the character. For example, "% 20" is returned by a space ". The characters with a value greater than 255 are stored in % uxxxx format.
Note: The escape method cannot be used to encode uniform resource identifiers (URIs. Use the encodeURI and encodeURIComponent methods for encoding.
2. unescape Method
Decodes String objects encoded using the escape method.
Unescape (charstring)
The required charstring parameter is the String object to be decoded.
Note:
The unescape method returns a string value containing charstring content. All characters encoded in % xx hexadecimal format are replaced by characters of medium price in the ASCII character set. Characters encoded in % uxxxx format (Unicode character) are replaced by Unicode characters encoded in hexadecimal format xxxx.
Note: The unescape method cannot be used to decode a Uniform Resource Identifier (URI ). The decodeURI and decodeURIComponent methods can be used to decode this code.