判断文件字符集
<!-- 判断文件编码格式 --> <dependency> <groupId>org.apache.any23</groupId> <artifactId>apache-any23-encoding</artifactId> <version>1.1</version> </dependency> public static Charset guessCharset(InputStream is) throws IOException { return Charset.forName(new TikaEncodingDetector().guessEncoding(is)); }