Reputation: 41
I am having hundeausführer
(in German) text in URL and it is giving me as hundeausf%C3%BChrer
in console.log. How can I convert hundeausf%C3%BChrer
back to hundeausführer
?
I tried
console.log(unescape(encodeURIComponent('hundeausf%C3%BChrer')));
console.log(decodeURIComponent(escape('hundeausf%C3%BChrer')));
but not getting a proper answer in the console log.
Getting the same text as hundeausf%C3%BChrer
Anyone help me to solve this out?
Upvotes: 3
Views: 25952
Reputation: 589
Use the decodeURI()
function
console.log(decodeURIComponent('hundeausf%C3%BChrer'));
>>hundeausführer
Upvotes: 6
Reputation: 113
This works for me.
console.log(decodeURI('hundeausf%C3%BChrer'));
Upvotes: 2