Solved

URL variable values encoded

Posted on 2013-11-11
2
268 Views
Last Modified: 2013-11-13
The url variable value looks like myname%40domain.ca

How do I take that in Javascript and convert it to myname@domain.ca?
0
Comment
Question by:intoxicated_curveball
  • 2
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 39639989
Test page : http://jsfiddle.net/45mHe/
var s = "myname%40domain.ca";
var d = unescape(s);

alert(d);

Open in new window

0
 
LVL 82

Expert Comment

by:leakim971
ID: 39639999
You may need decodeURI instead (will replace encoded :/;? too) :

var s = "myname%40domain.ca";
var d = decodeURI(s);

alert(d);

Open in new window


or decodeURIComponent instead (will replace encoded ~!@#$%^&*(){}[]=:/,;?+'"\ too) :

var s = "myname%40domain.ca";
var d = decodeURIComponent(s);

alert(d);

Open in new window


Check this article : http://xkr.us/articles/javascript/encode-compare/
Or google for : difference between escape and encodeuricomponent
https://www.google.com/search?q=difference+between+escape+and+encodeuricomponent
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now