FUNCTION:  URL.unescapeString

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
1. A URL cannot contain control characters.
2. The ( and ) were not unescaped by the Nokia simulator.
The mandatory String parameter can be any string of characters in which you desire to replace all hexadecimal unescape sequence with special characters. This string can also be a URL.
Code for UnescapeStringExample.wml
<?xml version="1.0"?>

<card id="card1">
   unescapeString example
   <do type="accept">
      <go href="UnescapeStringExample.wmls#findunescapestring()" />

<card id="card2">
   original string = $(original)
   <br />
   unescape string = $(unescape)


Code for UnescapeStringExample.wmls
extern function findunescapestring()
   var str = Dialogs.prompt("Enter URL", "");
   var une = URL.unescapeString(str);
   WMLBrowser.setVar("original", str);
   WMLBrowser.setVar("unescape", une);

Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information