admin管理员组文章数量:1410706
I believe that most people suggest using UTF-8 as the encoding for Javascript files.
Is there a standard about whether those files include the Byte-Order Mark, or do not included it? (i.e. Should JS files be served with/without the UTF-8 BOM?)
I'd like to see an RFC, or a "de facto" standard of this, and not so much an opinion of which is preferred by individuals.
I believe that most people suggest using UTF-8 as the encoding for Javascript files.
Is there a standard about whether those files include the Byte-Order Mark, or do not included it? (i.e. Should JS files be served with/without the UTF-8 BOM?)
I'd like to see an RFC, or a "de facto" standard of this, and not so much an opinion of which is preferred by individuals.
Share Improve this question asked Mar 27, 2013 at 21:04 Andrew ThekenAndrew Theken 3,4901 gold badge33 silver badges55 bronze badges 2- 2 stackoverflow./a/2223926 An answer that is unspecific to JS, but might be relevant. – Jon Sykes Commented Mar 28, 2013 at 12:37
- A related issue, here, where browsers are confused about the encoding of a javascript resource: stackoverflow./questions/52102142/… – Christopher Schultz Commented Aug 30, 2018 at 17:10
1 Answer
Reset to default 7Wikipedia has a good explanation of why NOT to include a BOM with UT8.
http://en.wikipedia/wiki/Byte_order_mark#cite_note-3
"Use of a BOM is neither required nor remended for UTF-8, but may be encountered in contexts where UTF-8 data is converted from other encoding forms that use a BOM or where the BOM is used as a UTF-8 signature"
本文标签: web standardsShould Javascript files include the BOM or notStack Overflow
版权声明:本文标题:web standards - Should Javascript files include the BOM or not? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744871907a2629678.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论