Javascript reads url params using wrong encoding

109 views Asked by At

I have html5 + js app which reads url params and make some requests. The initial requests looks like this:

https://www.google.com/?q=%D0%B0%D0%B1%D0%B2

But then when I'm reading url param with Javascript and creating another request it is executed like this:

GET /1.x/?format=json&someParam=?????? HTTP/1.1

How can I force Javascript to read properly Url params (to use proper encoding). One more important notice, this works absolutely fine in Chrome but in IE fails. Thank you for any suggestions

ps: html has head tag to specify encoding

<meta charset="UTF-8">
1

There are 1 answers

0
tcigrand On BEST ANSWER

You can use JavaScript's decodeURI function

decodeURI("https://www.google.com/?q=%D0%B0%D0%B1%D0%B2")
//returns https://www.google.com/?q=абв