Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing special characters in QueryString 1

Status
Not open for further replies.

spook007

Programmer
May 22, 2002
259
US
I'm trying to pass several values through a querystring. Unfortunately the values contain special characters that cause the querystring to mess up.

add.asp?article_name=Arts&Humanities?article_id=342

The above querystring messes up because of the '&' between Arts&Humanities, it thinks that Humanities is the next value being passed. How can I rewrite my querystring so it doesn't mess up when users enter '&' in the form?
 
The special character should be identifed as %intvalue% where "intvalue" is the ascii value of the character in hex. This is why some url's are like this:

It would actually read like this:
page.htm

0x20 is 32, the ascii value for a space.

If you're dynamically coming up with the string to pass in the url, you should use the JavaScript escape() method that will return you a string with all special characters converted to a query-string-readable value.

Hope that helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top