nano7
nano7

Reputation: 2493

Php Encode - Java Decode (URL parts)

I have code where an url is decoded in php. Then parts from it are used to create a String containing Key-Value-Pairs (like Param=EncodedPartOfUrl&Param2=EncondedPartofUrl&...) with (urlencode)

Now I want to decode it in Java. Can I use the URLDecoder for it or might there be a incompatibility? I also guess that in PHP there is no encoding scheme specified (when I understand the docs correctly) - how do I solve this then in java? Don't use a specified econding scheme (which is deprecated in Java 6 for URLDecoder)?

Upvotes: 0

Views: 1216

Answers (1)

shadyyx
shadyyx

Reputation: 16055

Can't You just build Your URL, then url_encode it in PHP and then use Your URLDecoder in Java (or whatever it is)?

URL encoding just of values from Key-Value pairs is not enough and not quite good approach - You should URL encode the whole URL for this...

EDIT:

Thanks for your answer, but I have no influence there. I can only work on the java side of code.

Then You have the only possibility: parse the URL to get the GET parameters and URL decode each of their values separately...

Upvotes: 1

Related Questions