home / experts / javascript / column59 |
|
Encoding and Decoding URIsThe URI (Universal Resource Index) is a standard format for specifying resources over the Internet. The principle behind this standard is that all its member characters are alphanumeric. All non-alphanumeric characters are replaced by a string in the form of "%xy" where xy being the ASCII encoding of the non-alphanumeric character. The target set of characters belong to to the ISO Latin-1 character set. The ISO Latin-1 (8859-1) is the standard set of characters used over the Internet. Only this standard is guaranteed to be supported on a Web site. Internet Explorer 5.5 introduced four new methods to encode strings to URIs as well as to decode URIs to strings. The first method,
should generate the following alert box:
Notice that the
and see the alert box that pops up:
The opposite conversion is done by
you get the expected alert box:
Using decodeURIComponent(uri):
you get the same alert box as above. If you try to decode the string with the %23 above with the other decoder ( Next: How to run the Stack operations |
Produced by Yehuda Shiran and Tomer Shiran
Created: March 14, 2000
Revised: April 26, 2000
URL: http://www.webreference.com/js/column59/7.html