Reputation: 41
I'm grabbing the query string parameters and trying to do this:
var hello = unescape(helloQueryString);
and it returns:
this+is+the+string
instead of:
this is the string
Works great if %20's were in there, but it's +'s. Any way to decode these properly so they + signs move to be spaces?
Thanks.
Upvotes: 4
Views: 18528
Reputation: 827822
The decodeURIComponent
function will handle correctly the decoding:
decodeURIComponent("this%20is%20the%20string"); // "this is the string"
Give a look to the following article:
Upvotes: 10
Reputation: 21848
Adding this line after would work:
hello = hello.replace( '+', ' ' );
Upvotes: 0