简体   繁体   English

如何轻松地从 .java 文件或其他类型的文件中删除字节顺序标记 (BOM)?

[英]How do you easily delete a Byte Order Mark (BOM) from a .java file or other types of file?

I kept having compile errors on my Continuous Integration & Deployment system.我的持续集成和部署系统一直有编译错误。

After some research I found that it was a BOM (Byte Order Mark) at the beginning of a .java file that was causing the error.经过一番研究,我发现是 .java 文件开头的 BOM(字节顺序标记)导致了错误。

What is the easiest way to remove the BOM from the file?从文件中删除 BOM 的最简单方法是什么?

I searched for various solutions (such as VI, VIM, and scripts), but in the end the easiest solution was to utilize p4merge, which allows you to view the BOM and simply delete it.我搜索了各种解决方案(例如 VI、VIM 和脚本),但最后最简单的解决方案是使用 p4merge,它允许您查看 BOM 并简单地将其删除。

You can get p4merge here for free.你可以在这里免费获得 p4merge。

I'm not affiliated with p4merge in anyway, but I do use it and find it useful as a diff/merge tool.无论如何,我不隶属于 p4merge,但我确实使用它并发现它作为 diff/merge 工具很有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM