• Post Reply Bookmark Topic Watch Topic
  • New Topic

Passing special characters in URL

 
Ankit Gandhi
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

In one of my forms i am sending '&' something as in ' joe & Sam' in the parameter list.

But when i do the getParameter for the above i get only till joe
the rest gets truncated.

Any pointers in this direction?

Thanks,
ankit
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try URL encoding of the parameter values.
 
Ankit Gandhi
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you give me a small snippet which shows how to encode/decode the URL. I am not familiar with the same.

Thanks,
Ankit
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This might be useful.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See:
http://java.sun.com/j2se/1.5.0/docs/api/java/net/URLEncoder.html
And:
http://java.sun.com/j2se/1.5.0/docs/api/java/net/URLDecoder.html

Make sure you encode only your strings, before pasting together the querystring. Don't just run the whole query string through it or it will encode the real control characters too.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!