I was just testing something with AJAX and I found that on success if I alert
alert(decodeURI(\'%\'));
or
alert(encodeURIC
I had the same issue as OP and found this useful topic. Had to find a way to check if URI string contained percent sign before using decodeURIComponent().
The piece of code from Ilia Rostovtsev works great except for URI which contains encoded characters like %C3 (where percent sign is starting by [A-F]) because the regex used doesn't handle them (only % followed by a decimal).
I replaced the following line:
x = mod ? arr[i].replace(/%(?!\d+)/g, '%25') : arr[i];
by
x = mod ? arr[i].replace(/%(?!\d|[ABCDEF]+)/g, '%25') : arr[i];
Now, it is working as the regex will reject %1A to %9F and also %A1 to %F9