views:

68

answers:

4

The following URL works fine:

http://localhost/mysite/mypage?param=123

However, if I want to put some special characters in `param like ?, /, \, then the URL becomes:

http://localhost/mysite/mypage?param=a=?&b=/

or

http://localhost/mysite/mypage?param=http://www.mysite.com/page2?a=\&b=...

which won't work. How do I resolve this issue?

+1  A: 

You need to use encode special characters, see this page for a reference.

If you're using PHP, there's a function to do this, called urlencode().

JYelton
+1  A: 

You have to encode special characters in URLs. See: http://www.w3schools.com/tags/ref_urlencode.asp

Steven Paligo
A: 

You need to substitute the characters with URL entities. Some information here.

Moonshield
+1  A: 

In JavaScript you can use the encodeURI() function.

ASP has the Server.URLEncode() function.

HttpServerUtility.UrlEncode in .NET

Vishal Seth