字符集编码检测
作者:jaddy0302 日期:2006-12-09
nsDetector det = new nsDetector(nsPSMDetector.ALL);
nsICharsetDetectionObserver nsIC = new nsICharsetDetectionObserver() {
String encod = "";
public void Notify(String charset) {
HtmlCharsetDetector.found = true;
encod = charset;
System.out.println("CHARSET = " + charset);
}
public String getEncoding() {
System.out.println("获得编码:" + encod);
return encod;
}
};
det.Init(nsIC);
det.DoIt(buf, buf.length, false);
det.DataEnd();
String encode = nsIC.getEncoding();

订阅
上一篇
下一篇
文章来自:
Tags: 




