How can I include special characters in query strings?

KentZhou picture KentZhou · May 13, 2010 · Viewed 90k times · Source

URL http://localhost/mysite/mypage?param=123 works fine. 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.example.com/page2?a=\&b=... which won't work. How do I resolve this issue?

Answer

Steven P. picture Steven P. · May 13, 2010

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