I have encoded my string(Say String a=”123+gtyt”) using URLEncoder class.The encoded string is String b. Then I am sending “String b” as a parameter appended to a URL. Lets say to http://example.com?request=b.
When I Decode the String at example.com using URLDecoder,The symbol + in my String is missing and I am not getting “String a” after decoding
Now When I print without decoding the “String b” at example.com.I get String a exactly.
So my doubt is whether the decoding is done by browser itself while redirecting?
When you encode “123+gtyt” – it encodes the plus sign.
When you handle an HTTP request, servlet API automaticaly decodes it to “123+gtyt”. If you decode it once again – it changes the “+” to a space.
So the key is – do not decode parameters explicitly.
For example: