應用日語編碼
public static String getHtmlEncoding(InputStream ins){
int n;
byte[] buf = new byte[4096];
ManHtmlCharsetDetector detector = new ManHtmlCharsetDetector(null);
try{
while ((n=ins.read(buf)) > 0 && !detector.isDone()) {
detector.handleData(buf, 0, n);
}
detector.dataEnd();
}catch(Exception e){
throw new MnsearchException(e);
}
return detector.getDetectedCharset();
}
int n;
byte[] buf = new byte[4096];
ManHtmlCharsetDetector detector = new ManHtmlCharsetDetector(null);
try{
while ((n=ins.read(buf)) > 0 && !detector.isDone()) {
detector.handleData(buf, 0, n);
}
detector.dataEnd();
}catch(Exception e){
throw new MnsearchException(e);
}
return detector.getDetectedCharset();
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.