Handling Special Chars in javascript

Posted by in JavaScript category on for Beginner level | Views : 9481 red flag

I was wondering how to handle special chars in the query string when redirecting the page to a different page with the help of Javascript. I thought of sharing this snippet.
Hope this will help you guys...

Here javascript escape is used to encode the string and unescape is to decode the string in Javascript.

var vstr = escape("It's wounderful!")


If you wanna handle this at server side use the following code.

string str = Server.UrlDecode(Request.QueryString["trial"]);

string str = Server.UrlEncode(Request.QueryString["trial"]);

Page copy protected against web site content infringement by Copyscape

About the Author

Full Name: Satish Kumar
Member Level: Starter
Member Status: Member
Member Since: 6/29/2007 10:01:12 AM

Happy Coding...

Login to vote for this post.

Comments or Responses

Login to post response

Comment using Facebook(Author doesn't get notification)