Java does not handle BOM properly. In fact Java handles a BOM like every other char.
Found this:
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;
}
May be I would use apache IO instead:
http://commons.apache.org/proper/commons-io/apidocs/org/apache/commons/io/input/BOMInputStream.html