IE encoding accented characters in javascript function with UrlEncode

I have a javascript function that takes a string as an argument, which is UrlEncoded.

I use tags with href = "javascript: ..." (I know that this is not correct, but its legacy code that I need to support ... and changing it to onclick will break our API.)

Chrome and Firefox correctly interpret "% C3% A9" in "é", but interpret it as "Ã ©". If it were in onclick, I could explicitly ignore the line, but with href = "javascript .." IE interprets it before I can stop it correctly.

<a href="javascript: alert('%C3%A9')">href</a> <a href="#" onclick="alert('%C3%A9')">onclick</a> 

See the script: http://jsfiddle.net/nCvsg/2/ (in IE).

The document is set to UTF8. Is there a way to solve this problem in IE?

+4
source share

Source: https://habr.com/ru/post/1492786/


All Articles