unescape

JavaScript FAQ | JavaScript Strings and RegExp FAQ  

Question: How do I convert strings from URL-encoding?

Answer: To convert a string from URL-encoded form, use the JavaScript function unescape(string). This function works as follows: if the string contains escape-sequences of the form %XX, where XX stands for two hexadecimal digits, each escape-sequence is replaced by the character whose ASCII code is XX. Otherwise, the string remains unchanged.

(In Unicode-aware browsers, in addition to escape-sequences %XX, the unescape function also processes sequences of the form %uXXXX; see also escape.)

Example:

unescape("It%27s%20me%21")  
// result: "It's me!"

Copyright © 1999-2011, JavaScripter.net.