Share via

Escape Function

Encodes a string so it contains only ASCII characters.



  • charString
    Required. String expression to be encoded.

The Escape function returns a string (in Unicode format) that contains the contents of charString. All spaces, punctuation, accented characters, and other non-ASCII characters are replaced with %xx encoding, where xx is equivalent to the hexadecimal number representing the character. Unicode characters that have a value greater than 255 are stored using the %uxxxx format.

The string that the Escape function returns is suitable for transmission with many protocols, such as the HTTP protocol.


Because the Escape function is not designed to create a valid uniform resource identifier (URI), it should not be used to encode URIs. The JScript encodeURI method may be used to encode URIs.


Version 5

See Also


Unescape Function

encodeURI Method (Windows Scripting - JScript)