如何以编程方式查找文件的编码?

问题描述:

可能重复:
Java : How to determine the correct charset encoding of a stream如何以编程方式查找文件的编码?

如何使用JAVA识别输入文件的编码?

+1

什么样的编码?它是一个图像文件,文本文件(unicode,多字节代码页,office文档?) – rwong 2010-08-01 13:55:57

+0

我假设他是指文本文件的字符编码(即代码页)。 – 2010-08-01 14:07:33

+1

也相关:http://*.com/questions/774075/character-encoding-detection-algorithm – McDowell 2010-08-01 14:19:42

检测给定文本的正确编码不是精确的科学。以上所有软件均为近似值。