简体   繁体   中英

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 )?

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...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM