I have explained all the steps below and captured data at each stage.
I can't understand why urldecode is not working correctly in this case?
Original String:
<p>hello</p>
Javascript encodeURIComponent() of above string:
%3Cp%3E%E2%80%8Bhello%3C%2Fp%3E
Sent via Ajax:
%3Cp%3E%E2%80%8Bhello%3C%2Fp%3E
PHP: Echo $_REQUEST['string'];
%3Cp%3E%E2%80%8Bhello%3C%2Fp%3E
PHP: urldecode of above string
​hello
There's a special hidden character between
>
andh
. You'll be able to see it if you view the string as html in a browser.