diff --git a/source/net/yacy/document/parser/htmlParser.java b/source/net/yacy/document/parser/htmlParser.java index 875e19d2b..a7d4c891e 100644 --- a/source/net/yacy/document/parser/htmlParser.java +++ b/source/net/yacy/document/parser/htmlParser.java @@ -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); }