I have a html text. I had encoded it in php using urlencode function. I want to decode that text in the javascript. when i use unescape function in javascript it replaces a
Try this:
return decodeURIComponent((str + '').replace(/\+/g, '%20'));
Source: http://phpjs.org/functions/urldecode:572