Mercer
Mercer

Reputation: 9986

Decode url which has been encoded in javascript

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?

Upvotes: 0

Views: 148

Answers (2)

SQL.injection
SQL.injection

Reputation: 2647

Use the class URLDecoder

You can you use it for both encoding and decoding.

Upvotes: 1

AlexR
AlexR

Reputation: 115328

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?

Upvotes: 4

Related Questions