Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Special charecters in URL

 
Neeraj Vij
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need to pass special charecters in a querystring when I click on a hyperlink.

charecters like #, ^, spaces.. how to do it.

please help.

Thanks,
Neeraj.
 
Katrina Owen
Sheriff
Posts: 1367
18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

If you find the hex value of the characters you need to pass in, you can use those.

the hexadecimal value for a space is 20, and in a URL you can encode this as %20
the caret is %5E
the pound character is %23

I'm sure some good references should come up if you google "url encoding" or "url hex encoding"
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
 
Neeraj Vij
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for the help.

but we are using jdk1.4 in our project. so looking for a different solution.

thanks,
Neeraj.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but we are using jdk1.4 in our project. so looking for a different solution.


That class has been there since Java 1.0.
 
Neeraj Vij
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I was using eclipse 3.0. URLEncoder class gave error.

let me check and update.

Thanks,
Neeraj.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Follow the link I posted to that API page.
Notice that there is a deprecated version of encode and a newer version that takes two arguments (which has been there since version 1.4).

Maybe you were using the deprecated version?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic