Name

unescape( ) Global Function — decode an escaped string

Availability

Flash 5

Synopsis

unescape(stringExpression)

Arguments

stringExpression

A string (or expression that resolves to a string) that was previously encoded via escape( ).

Returns

A new string that is a decoded version of string.

Description

The unescape( ) function returns a new string based on string. The new string contains equivalent Latin 1 characters for every occurrence of a two-digit hexadecimal escape sequence prefixed with % in string. The escape( ) and unescape( ) functions are used to encode and decode strings for safe transfer over a network. However, manual use of unescape( ) is rarely necessary as Flash automatically converts URL-encoded text when it is imported via loadVariables( ).

Example

var msg = "hello!";
// Set msgCoded to "hello%21"
msgCoded = escape(msg);
// Set msgDecoded to "hello!"
var msgDecoded = unescape(msgCoded);

See Also

escape( ); Appendix B

Get ActionScript: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.