• Post Reply Bookmark Topic Watch Topic
  • New Topic

Special characters with query string

 
sridhar lakka
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Thanks in advance.
I have some issues, please help me in this,
I have one user input field say 'Name', user can give any type of string characters including(',":;\/).And I am storing those values to Database.
But, There are some pages/Pop up pages from which I will pass this "Name" with link. And Some where in javascript iam using this name like alerts.

In these both situations this is failing, Please help me.

Regards,
Sree
 
bnkiran kumar
Ranch Hand
Posts: 176
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try html encoding of the parameter before passing it as query parameter...
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by sridhar lakka:

In these both situations this is failing,


This doesn't give us much to work with.
Where is it failing; on the server in the browser?
Are you escaping characters like quotes before you write them to the page when you know you're going to be using the name in a Javascript function?
 
Amit M Tank
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use URLEncoder.encode to send the parameters
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Amit M Tank:
Use URLEncoder.encode to send the parameters


Correction, "to encode the parameters". This method will do no "sending".
[ June 25, 2007: Message edited by: Bear Bibeault ]
 
bnkiran kumar
Ranch Hand
Posts: 176
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May be Amit wants to tell URLEncode.encode to encode the query parameter and then send..... is it correct Amit...
 
Amit M Tank
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes Kiran. That is exactly what I meant. Thanks for correcting.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!