1129Chapter 42 .Global Functions and Statements handy here). (Web hosting provider)

1129Chapter 42 .Global Functions and Statements handy here). If you are decoding URI strings that your scripts encoded, use the decode functions only on URIs that were encoded via the corresponding encode function. Do not attempt to decode a URI that was created via the old escape() function because the conversion processes work according to different rules. The difference between a URI and a URI component is that a component is a sin gle piece of a URI, generally not containing delimiter characters. For example, if you use the encodeURIComponent() function on a complete URI, almost all of the sym bols (other than things such as periods) are encoded into hexadecimal versions including directory delimiters. Therefore, you should use the component-level con version functions only on quite granular pieces of a URI. For example, if you assem ble a search string that has a name/value pair, you can use the encodeURIComponent() function separately on the name and on the value. But if you use that function on the pair that is already in the form name=value, the func tion encodes the equal symbol to a hexadecimal equivalent. Use The Evaluator (Chapter 13) to experiment with the differences between encoding a full URI and a component and encoding and escaping a URI string. For example, compare the results of the following three statements: escape( http://www.giantco.com/index.html?code=42 ) encodeURI( http://www.giantco.com/index.html?code=42 ) encodeURIComponent( http://www.giantco.com/index.html?code=42 ) Because the sample URI string is valid as is, the encodeURI() version makes no changes. Experiment further by making the search string value into a string with a space, and see how each function treats that character. escape( URIString [,1]) unescape( escapedURIString ) Returns: String. NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility . . . If you watch the content of the Location field in your browser, you may occasionally see URLs that include a lot of % symbols plus some numbers. The format you see is URL encoding (more accurately called URI encoding Uniform Resource Identifier rather than Uniform Resource Locator). This format allows even multiple word strings and nonalphanumeric characters to be sent as one contiguous string of a very low, common-denominator character set. This encoding turns a character, such as a space, into its hexadecimal equivalent value preceded by a percent symbol. For example, the space character (ASCII value 32) is hexadecimal 20, so the encoded version of a space is %20. All characters, including tabs and carriage returns, can be encoded in this way and sent as a simple string that can be decoded on the receiving end for reconstruction. You can also use this encoding to preprocess multiple lines of text that must be stored as a character string in databases. To convert a plain-language escape()
In case you need quality webspace to host and run your web applications, try our personal web hosting services.

Leave a Reply