Name

unescapeString — Undo URL escaping on a string

Usage

URL.unescape (str)

str : String

Description

Returns a new string in which all escape sequences in str of the form % hh (where hh is two hex digits) have been replaced with the ASCII character with hex code hh.

Returns invalid if str can’t be converted to a string, if it contains characters from outside the US-ASCII character set, or if any of the escape sequences have hex values greater than %7F.

Example

URL.unescapeString("%2Ffoo.cgi%3Ffoo%3D1%26bar%3D2")

returns string "/foo.cgi?foo=1&bar=2"

Get Learning WML, and WMLScript 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.