Reputation: 66590
I have url like this: https://pl.wikipedia.org/wiki/Muzeum_Dawnej_Wsi_%E2%80%9EDomek_Tkaczki%E2%80%9D in browser address bar it show up as Muzeum_Dawnej_Wsi_„Domek_Tkaczki” but when I copy it to clipboard it show encoded, how can I unescape the url like this? I've tried to use this:
unescape(location.href);
but got url that look like this:
https://pl.wikipedia.org/wiki/Muzeum_Dawnej_Wsi_âDomek_Tkaczkiâ
Upvotes: 0
Views: 55
Reputation: 522500
unescape
is incomplete and deprecated:
Note: Do not use
unescape
to decode URIs, usedecodeURI
instead.https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/unescape
The latter works as expected:
console.log(decodeURI('https://pl.wikipedia.org/wiki/Muzeum_Dawnej_Wsi_%E2%80%9EDomek_Tkaczki%E2%80%9D'));
Upvotes: 2