如何修复“在UTF-8文件中找到的字节顺序标记”验证警告 [英] How to fix "Byte-Order Mark found in UTF-8 File" validation warning

查看:187
本文介绍了如何修复“在UTF-8文件中找到的字节顺序标记”验证警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个xhtml页面在xhtml strict doctype下验证 - 但是,我得到这个警告,我试图理解,并更正。

I've got an xhtml page validating under xhtml strict doctype -- but, I getting this warning which I trying to understand -- and correct.

只是,我如何找到这个错误的字节顺序标记。我正在使用Visual Studio编辑我的文件 - 不知道这是否有帮助。

Just, how do I locate this errant "Byte-Order Mark". I'm editing my file using Visual Studio--not sure if that helps.


在UTF-8档案中找到警告字节顺序标记。

Warning Byte-Order Mark found in UTF-8 File.

已知UTF-8编码文件中的Unicode字节顺序标记(BOM)会导致某些文本编辑器和旧版本浏览器出现问题。您可以考虑避免使用它,直到它得到更好的支持。

The Unicode Byte-Order Mark (BOM) in UTF-8 encoded files is known to cause problems for some text editors and older browsers. You may want to consider avoiding its use until it is better supported.


推荐答案

您的问题很容易:字节顺序标记(BOM)将在最开始

The location part of your question is easy: The byte-order mark (BOM) will be at the very beginning of the file.

编辑档案时,请前往档案|高级保存选项... ,您应该找到一个编码下拉列表(以及行结束下拉列表)。它可能设置为使用Unicode(带签名的UTF-8) - 代码页65001。如果你向下滚动一个公平的位,你可以找到Unicode(UTF-8无签名) - 代码页65001。这应该做它(如果你想)。

When editing the file, go to File | Advanced Save Options... and you should find an "Encoding" drop-down (along with a "Line endings" drop-down). It's probably set to use "Unicode (UTF-8 with signature) - Codepage 65001". If you scroll down a fair bit, you can find "Unicode (UTF-8 without signature) - Codepage 65001". That should do it (if you want to). Some systems may be confused by a BOM on a UTF-8 file, as the warning indicates.

另请参阅此注释在Unicode网站的常见问题中关于BOM和UTF-8文件。它没有其他功能,除了调用,该文件是,其实是UTF-8。特别是,它对字节顺序(我们有BOM的主要原因)没有影响,因为UTF-8的字节顺序是固定的。

See also this note in the Unicode site's FAQ about the BOM and UTF-8 files. It has no function other than to call out that the file is, in fact, UTF-8. In particular, it has no effect on the byte order (the main reason we have BOMs), because the byte order of UTF-8 is fixed.

这篇关于如何修复“在UTF-8文件中找到的字节顺序标记”验证警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆