Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Escaping the "%" character when used with URLEncoder/URLDecoder

Avatar of HPBSM
HPBSM asked on
JavaJava EE
15 Comments1 Solution4760 ViewsLast Modified:
Hello!

I want to ask how could I escape the "%" character when using URLEncoder.encode(String, ENCODING)?

I have a String object that I want to send to the server side. This String object can contain the characters:
" ' / > < \ % ?
I encode the String in the client side using the "URLEncoder.ecode(String, "UTF-8")" method, but when I try to decode on the server side using "URLDecoder.decode(String, "UTF-8")" method, I get an IllegalArgumentException:

java.lang.IllegalArgumentException: URLDecoder: Incomplete trailing escape (%) pattern

So, my question is how can I encode my String object so that the "%" character (or any of the other characters) will be escaped and won't be considered as special character/s?

Thanks in advance!

Cheers,
Radu
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
Commented:
This problem has been solved!
Unlock 1 Answer and 15 Comments.
See Answers