I have a String String a="123+>jo I want to en
code the String so that I can redirect it to an url. I initially tried it with urlencoder but in urldecoder +(plus) is removed while decoding.So i lost my data.
What is the right way to encode so that I get the same string while decoding also?
URLEncoder works perfectly. The plus sign is succesfully encoded into
%2B.Encoding: Works
Here is the IDEONE project:
http://ideone.com/zMDur
prints:
Encoding + Decoding: Works
The IDEONE project with decoding as well: http://ideone.com/Ypfv4
Prints:
So everything works using the
java.net.URLEncoderandjava.net.URLDecoder.