摘要: 获取txt文档的编码方式,亲测可用。public static String getCharset(File file) { String charset = "GBK"; // 默认编码 byte[] first3Bytes = new byte[3]; try { boolean checked = false; BufferedInputStream bis = new BufferedInputStream( new FileInputStream(file)); ... 阅读全文