I have some html that is output by PHP’s urlencode – basically it’s a simple bunch of anchors that look like this:
<a href="#i+have+some+spaces">link1</a>
I’m using jquery to take a look at all these references when they’re clicked, however, I can’t seem to decode it using any of the browser’s internal functions. Do I have to replace +’s by myself?
unescape('Video+Games'); // returns Video+Games
decodeURI('Video+Games'); // returns Video+Games
decodeURIComponent('Video+Games'); // returns Video+Games
I do think you need to do your own
.replace(), as in:EDIT: I thought I had a MDC document that specified this, but the closest I can find right now is this note.
https://developer.mozilla.org/Talk:en/JavaScript/Reference/Global_Objects/decodeURIComponent
I may have been thinking of this note from the MDC encodeURIComponent docs: