We are interpolating a URL onto our page, it is coming from Rails and gets automatically escaped like so:
"http://foo.bar/path?key=val&key2=val2"
Notice &
is there where it should be &
.
This URL no longer works properly.
We did get it working by using Rails' raw
method which prevents the escaping.
But I would prefer to do this using Javascript, and I'm sure there's a way.
I tried unescape, decodeURI, and decodeURIComponent, they don't work
str = "http://foo.bar/path?key=val&key2=val2"
decodeURIComponent(str) == str // true
decodeURI(str) == str // true
unescape(str) == str // true