How to pass characters like+ as parameter in the URL
Murali Koppula
Greenhorn
Joined: May 07, 2002
Posts: 10
posted
0
I have a jsp file that accepts parameters from URL. But when a character like + is part of the value of a parameter, its doesn't get passed (instead, it substitutes a space). Is there an escape character to be used in such case? I tried using back slash (\), enclosing in quotes, using its value (043, #043, + etc.). Nothing seemed to work. Any suggestions? Thanks, Murali.
Bear Bibeault
Author and opinionated walrus
Marshal
If you are trying to encode the string on the client-side, the encodeURIComponent() function should do the trick for you. On the server side, URLEncoder.encode() will perform the encoding. Btw, '+' encodes as %2B. hth, bear