读书人

String编码(5) 文件编码检测

发布时间: 2013-03-29 14:24:52 作者: rapoo

String编码(五) 文件编码检测

1.2)测试

在D:/FileReaderTest中创建文件

fileReaderTest-GBK.txt

fileReaderTest-Unicode.txt

fileReaderTest-UnicodeBE.txt

fileReaderTest-UTF8.txt

GBK.txt

Unicode.txt

UTF8.txt

文件编码格式如文明名所示,fileReaderTest*.txt由windows创建,其余三个由eclipse创建。

程序运行结果

?1.3)测试

运行FileEncodingDetectorTest.java,结果如下

Encoding type of fileReaderTest-GBK.txt is GB2312Encoding type of fileReaderTest-Unicode.txt is UTF-16LEEncoding type of fileReaderTest-UnicodeBE.txt is UTF-16BEEncoding type of fileReaderTest-UTF8.txt is UTF-8Encoding type of GBK.txt is GB2312Encoding type of Unicode.txt is UTF-16BEEncoding type of UTF8.txt is UTF-8

?1.4)参考资料

http://cpdetector.sourceforge.net/

读书人网 >编程

热点推荐