Android Studio 将 BOM 写入 UTF-8 文件 [英] Android Studio writing BOM's to UTF-8 file
问题描述
我正在开发一个项目,其中所有源文件都被编码为 UTF-8,以取悦 java 编译器(否则,它会在其他编码上吐出错误).每次我用Android Studio保存一个源文件时,它都会在文件上写一个字节顺序标记,阻止编译成功.我该如何解决这个问题?
I am working on a project where all the source files are encoded as UTF-8, to please the java compiler (otherwis, it will spit out errors on other encodings). Everytime I save a source file with Android Studio, it will write a Byte Order Mark on the file, preventing the compilation from succeeding. How can I fix this?
作为一种解决方法,我正在使用十六进制编辑器手动删除 BOM,但这真的很烦人.
As a workaround, I am manually deleting the BOM with a Hex Editor but it gets really annoying.
推荐答案
移除 BOM 对我不起作用.
Remove BOM Didn't work for me.
这是我从网站复制的代码的问题.
It's the problem for the code I copied from a website.
我又写了一遍,问题解决了.
I wrote it again and problem solved.
这篇关于Android Studio 将 BOM 写入 UTF-8 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!