Replaces hexadecimal escape sequences with the special characters they represent.
The
URL.unescapeString function replaces all hexadecimal escape
sequences in the given string (including a URL string) with the
appropriate special characters and returns the modified string. The
modified string (URL) is said to be unescaped.
The companion URL.escapeString function replaces all special
characters with the appropriate hexadecimal escape sequences.
A hexadecimal unescape sequence is composed of a
mandatory percent sign followed immediately by the two-digit
hexadecimal number (i.e., %2A). There are sixteen hexadecimal numbers:
1 2 3 4 5 6 7 8 9 0 A B C D E F (or a b c d e f)
Here is a list of special characters that can be
unescaped for a URL.
Please refer to: RFC2396 Uniform Resource Identifiers (URI): Generic
Syntax.
| Character | Unescape Sequence |
| control key | see footnote 1 |
| blank space | %20 |
| ; | %3B |
| / | %2F |
| ? | %3F |
| @ | %40 |
| %26 | |
| = | %3D |
| + | %2B |
| $ | %24 |
| , | %2C |
| ( | see footnote 2 |
| ) | see footnote 2 |
| | | %7C |
| \ | %5C |
| ^ | %5E |
| [ | %5B |
| ] | %5D |
| ' | %27 |
| %3C | |
| %3E | |
| # | %23 |
| % | %25 |
| * | %22 |
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC
"-//WAPFORUM//DTD WML 1.1//EN"
"http://www.WAPforum.org/DTD/wml_1.1.xml">
<wml>
<card id="card1">
<p>
unescapeString example
</p>
<do
type="accept">
<go
href="UnescapeStringExample.wmls#findunescapestring()" />
</do>
</card>
<card id="card2">
<p>
original string = $(original)
<br />
unescape
string = $(unescape)
</p>
</card>
</wml>Code for UnescapeStringExample.wml
extern function
findunescapestring()
{
var str =
Dialogs.prompt("Enter URL", "");
var une =
URL.unescapeString(str);
WMLBrowser.setVar("original", str);
WMLBrowser.setVar("unescape", une);
WMLBrowser.go("UnescapeStringExample.wml#card2");
};
Code for UnescapeStringExample.wmls