开发者

Special characters are not being read from a JSONP file correctly in IE8

开发者 https://www.devze.com 2023-02-06 18:28 出处:网络
Same problem as a previous question I asked but specifically for IE, since the answer I gave works in everything except IE. So this question is specifically for IE:

Same problem as a previous question I asked but specifically for IE, since the answer I gave works in everything except IE. So this question is specifically for IE:

How can I set the charset to be used when reading a javascript file via a script element in IE?

开发者_JAVA百科

I have a JSON file with a character in it and when I include the file on to my HTML page with <script charset="Cp1252" ... (which works in every other browser) on IE, then I get the following character .


Internet Explorer requires that the value for charset is Windows-1252.

  • Windows-1252 (MSDN)

This should be a more universally compatible value for the charset attribute - HTML5 defines that the value should be a case-insensitive match of a name or alias in the IANA Character Sets Registry:

Name: windows-1252
MIBenum: 2252
Source: Microsoft  (http://www.iana.org/assignments/charset-reg/windows-1252) 
Alias: None

I know that Firefox supports this value too, as a synonym for CP1252, the specification suggests that other browsers should too.

0

精彩评论

暂无评论...
验证码 换一张
取 消