php urldecode not working correctly when receiving response from ajax in javascript

664 Views Asked by At

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
1

There are 1 best solutions below

0
On

There's a special hidden character between > and h. You'll be able to see it if you view the string as html in a browser.