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?

Mercer
  • 9,736
  • 30
  • 105
  • 170

2 Answers2

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?

Community
  • 1
  • 1
AlexR
  • 114,158
  • 16
  • 130
  • 208
1

Use the class URLDecoder

You can you use it for both encoding and decoding.

SQL.injection
  • 2,607
  • 5
  • 20
  • 37