f1ori 15 years ago
parent 8fe1102452
commit ddcd5ae78c

@ -83,14 +83,20 @@ public class htmlParser extends AbstractParser implements Parser {
// make a scraper
final ScraperInputStream htmlFilter = new ScraperInputStream(sourceStream,documentCharset,location,null,false);
String charset = null;
try {
charset = htmlFilter.detectCharset();
} catch (IOException e1) {
throw new Parser.Failure("Charset error:" + e1.getMessage(), location);
if (documentCharset != null) {
charset = patchCharsetEncoding(documentCharset);
}
if (charset == null) {
try {
charset = htmlFilter.detectCharset();
} catch (IOException e1) {
throw new Parser.Failure("Charset error:" + e1.getMessage(), location);
}
}
if (charset == null) {
charset = documentCharset;
} else {
charset = patchCharsetEncoding(charset);
}

Loading…
Cancel
Save