0

It's possible to decode url in java which has been encoded in javascript

js:

 params.url = encodeURIComponent(url);

Does anyone know the correct way of doing this?

3
  • w3schools.com/jsref/jsref_decodeuricomponent.asp Commented Jan 6, 2015 at 9:24
  • @SimonStaton there is the same function in Java .? Commented Jan 6, 2015 at 9:25
  • 1
    Read the question wrong, assumed you meant js Commented Jan 6, 2015 at 9:26

2 Answers 2

4

Use java.net.URLDecoder.

But pay attention that there are several differences between java and javascript implementations.

For details take a look on:

Difference in URL decode/encode UTF-8 between Java and JS/AS3 (bug!?)

Java equivalent to JavaScript's encodeURIComponent that produces identical output?

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

Comments

1

Use the class URLDecoder

You can you use it for both encoding and decoding.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.