Special characters are not being read from a JSONP

2019-05-23 05:11发布

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?

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 .

1条回答
仙女界的扛把子
2楼-- · 2019-05-23 05:36

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

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.

查看更多
登录 后发表回答