Visit Mozilla.org

Core JavaScript 1.5 Guide:Predefined Functions:escape and unescape Functions

From MDC

[edit] escape and unescape Functions

The escape and unescape functions let you encode and decode strings. The escape function returns the hexadecimal encoding of an argument in the ISO Latin character set. The unescape function returns the ASCII string for the specified hexadecimal encoding value.

The syntax of these functions is:

escape(string)
unescape(string)

These functions are used primarily with server-side JavaScript to encode and decode name/value pairs in URLs.

The escape and unescape functions do not work properly for non-ASCII characters and have been deprecated. In JavaScript 1.5 and later, use encodeURI, decodeURI, encodeURIComponent, and decodeURIComponent.

« Previous Next »