This isn’t working for me:
var foo = "Collection%3A 9 Bad Interviews With Former GOP Presidential Candidates";
console.log(decodeURI(foo));
It outputs:
Collection%3A 9 Bad Interviews With Former GOP Presidential Candidates
That’s not correct, if you enter the foo string on a site like this:
http://meyerweb.com/eric/tools/dencoder/
It shows the right output, which is:
Collection: 9 Bad Interviews With Former GOP Presidential Candidates
How to properly decode the string?
Differences between decodeURI and decodeURIComponent
The main differences are:
So, in encodeURIComponent these separators are encoded also because they are regarded as text and not special characters.
Now back to the difference between the decode functions, each function decodes strings generated by its corresponding encode counterpart taking care of the semantics of the special characters and their handling.
so in your case decodeURIComponent does the job