if(decode) chars = new RefsDecoder().decode(chars);
return createDocument(chars);
}
public String detectCharset(byte [] bytes) {
EncodingDetector encodingDetector = new EncodingDetector();
String codeCharset = encodingDetector.detect(bytes);
if(codeCharset == null) codeCharset = "utf-8";
try {
HTMLDocument document = createDocument(bytes, codeCharset);
String docCharset = getCharset(document);
if(docCharset == null