使用Java删除BOM字符
使用Java等同于vis 的字符串需要发生什么
:set nobomb假设它BOM来自我正在读取的文件。
回答:
Java无法正确处理BOM。实际上,Java像处理其他所有char一样处理BOM。
发现了这一点:
http://www.rgagnon.com/javadetails/java-handle-utf8-file-with-
bom.html
public static final String UTF8_BOM = "\uFEFF";private static String removeUTF8BOM(String s) {
    if (s.startsWith(UTF8_BOM)) {
        s = s.substring(1);
    }
    return s;
}
可能是我改用apache IO:
http://commons.apache.org/proper/commons-
io/apidocs/org/apache/commons/io/input/BOMInputStream.html
以上是 使用Java删除BOM字符 的全部内容, 来源链接: utcz.com/qa/418313.html








