I found a great function urlDecode() here - https://stackoverflow.com/a/4458580/8950583
After years of usage I have a problem with this function now.
I have text string:
{{form.Rate_%%20|%20url_encode}}
It should return:
{{form.Rate_% | url_encode}}
But it returns error like "malformed URI" because of that seqeunce "%%20"
I made a quick fix by adding .replace(/%%/g, '%25%') to the function - so now it is:
function urlDecode(str) {
return decodeURIComponent((str+'').replace(/%%/g, '%25%').replace(/\+/g, '%20'));
}
But I am not sure if it will not cause problems in any circumstances.
Please do you thing it is safe? Or how would you handle it?