分类:
2010-06-19 09:59:57
usingMozilla.NUniversalCharDet;
publicstaticstringDetectEncoding_Bytes(byte[]DetectBuff)
{
intnDetLen=0;
UniversalDetectorDet=newUniversalDetector(null);
//while(!Det.IsDone())
{
Det.HandleData(DetectBuff,0,DetectBuff.Length);
}
Det.DataEnd();
if(Det.GetDetectedCharset()!=null)
{
returnDet.GetDetectedCharset();
}
return"utf-8";
}