I have a string with unicode characters that I am transferring via HTTP. This string was encoded with Javascript's encodeURIcomponent()
. Is there an equivalent function in php to Javascript's decodeURIComponent()
?
Asked
Active
Viewed 4.6k times
2 Answers
72
urldecode()
However you do not need to use it on $_REQUEST variables, which are already decoded automatically.

Explosion Pills
- 188,624
- 52
- 326
- 405
-
1i have used $_POST for fetching,but urldecode() doesnt work on unicode characters. – neonant Oct 09 '10 at 08:35
-
17– Explosion Pills Oct 09 '10 at 08:37
-
2@ExplosionPills was that double semicolon at the end a typo? – CJT3 May 18 '13 at 10:33
-
4Side note: I am using `encodeURIComponent()` to pass data to a Laravel application and the request doesn't seem to automagically decode the value. – Matt K Nov 18 '16 at 22:43
-
1Be careful: `urldecode('+') === ' '` and `decodeURIComponent('+') === '+'`. Currently dont know why. – Илья Зеленько Jun 18 '20 at 17:39