Use proper URI escape/unescape in JS

See http://unixpapa.com/js/querystring.html