jQuery in Action, 2nd edition*
The moose likes HTML, CSS and JavaScript and the fly likes javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "javascript" Watch "javascript" New topic
Author

javascript

hemant singh
Greenhorn

Joined: Nov 04, 2001
Posts: 4
Hi All
In my application i dynamically create link references and if they come to
be something like <a href="somefile.jsp?query=abc#09*(">link</a> and
clicking this link takes me to another page where i retrieve this query
value , i get only those characters before # appear(ie i get abc in this
case).can anybody suggest any way of transfering special characters in the
querystring....i have already tried out escape and unescape methods.
Hemant
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Special characters in URLs get escaped by converting them to the 2-digit hexadecimal value of the character with a '%' before it. ie a space character's hex code is 20 therefore it gets escaped as &space=%20
I don't have a list of the char to hex mappings but I'm sure someone has them somewhere (or you could write something to get them yourself)
Dave.
hemant singh
Greenhorn

Joined: Nov 04, 2001
Posts: 4
thanks david...but dont we have some method in java or JSP which does this for us automatically..
Originally posted by David O'Meara:
Special characters in URLs get escaped by converting them to the 2-digit hexadecimal value of the character with a '%' before it. ie a space character's hex code is 20 therefore it gets escaped as [b]&space=%20
I don't have a list of the char to hex mappings but I'm sure someone has them somewhere (or you could write something to get them yourself)
Dave.[/B]

David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

well, if you have the data in a form it will get converted automatically, but I don't have a book handy at the moment to see if there is an automatic javascript way...

This is only way I'm aware of getting the automatic character conversion.
hemant singh
Greenhorn

Joined: Nov 04, 2001
Posts: 4
even if i dont do anything with the generated URL and click over it , the queries are passed at the back end but when i do request.getParameter() , i get only those characters before #...thats the problem.so is there any way to retriev the value available in the query
Originally posted by David O'Meara:
[B]well, if you have the data in a form it will get converted automatically, but I don't have a book handy at the moment to see if there is an automatic javascript way...

This is only way I'm aware of getting the automatic character conversion.[/B]

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javascript