1

Possible Duplicate:
php javascript url encoding

if I encode a url with javascript's encodeURI(), will I be able to use PHP's url_decode to decode it without any possibility of error?

similar question for the other direction (encode with url_encode() in PHP, decode with javascript)

1
  • 1
    Not a duplicate of 1105434 - It's the opposite direction (as pointed out by the OP) Commented Jun 13, 2011 at 16:16

1 Answer 1

1

If you're attempting to pass a URI as a parameter, you'll probably want to use Javascript's encodeURLComponent() method. If I remember right, PHP's urlencode/urldecode methods expect all non-alphanumeric characters to be encoded (which Javascript's encodeURI does not seem to do).

For more information:
http://www.w3schools.com/jsref/jsref_encodeURI.asp
http://www.w3schools.com/jsref/jsref_encodeURIComponent.asp
https://www.php.net/urlencode
https://www.php.net/manual/en/function.urldecode.php

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.