This should simple task, but I can't seem to find a solution.
I have a basic string that is being passed through as a query string parameter like this one: This+is+a+message+with+spaces
. I would like to decode that parameter using Javascript to This is a message with spaces
, but I cannot seem to get it to decode.
I've tried decodeURI('This+is+a+message+with+spaces')
but the result still contains the +
signs.
Any help would be appreciated. Thank you!
decodeURIComponent('This+is+a+message+with+spaces')
still returnsThis+is+a+message+with+spaces
.encodeURIComponent('This+is+a+message+with+spaces')
returnsThis%2Bis%2Ba%2Bmessage%2Bwith%2Bspaces
. I must be missing something because I'm not seeing how this is solving my problem. – user852367 Aug 20 '12 at 18:02