From 7fd70c69773bcd914ba794d91c7fa4f12a6dcdf5 Mon Sep 17 00:00:00 2001 From: dbera Date: Thu, 1 Jun 2006 19:08:27 +0000 Subject: [PATCH] Dont throw EncodingFoundException unless asked to. Should remove the occassional uncaught EncodingFoundException thrown for documents/strings without any specified encoding. --- Filters/HtmlAgilityPack/HtmlDocument.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Filters/HtmlAgilityPack/HtmlDocument.cs b/Filters/HtmlAgilityPack/HtmlDocument.cs index 556f31b3..05bc5d8c 100644 --- a/Filters/HtmlAgilityPack/HtmlDocument.cs +++ b/Filters/HtmlAgilityPack/HtmlDocument.cs @@ -1808,8 +1808,16 @@ namespace HtmlAgilityPack (node.Name != "head" && node.Name != "script" && node.Name != "style" && node.Name != "title" && node.Name != "head" && node.Name != "link" && - node.Name != "html" && node.Name != "meta")) - throw new EncodingFoundException (null); + node.Name != "html" && node.Name != "meta")) { + _declaredencoding = null; + if (_onlyDetectEncoding) + throw new EncodingFoundException (null); + else + return; + // FIXME: Should also handle declaredencoding mismatch with detected + // encoding, as done below. None of the current filters run in error + // detection mode currently, so its not needed now. + } else if (node.Name == "meta") // all nodes names are lowercase { HtmlAttribute att = node.Attributes["http-equiv"]; -- 2.11.4.GIT