This project has moved and is read-only. For the latest updates, please go here.

encoding pass problem: AutoDetectEncoding = false not help me

Topics: User Forum
Dec 29, 2006 at 10:25 PM
In HtmlWeb.cs i see this:
/// Gets or Sets a value indicating if document encoding must be automatically detected.
public bool AutoDetectEncoding

So i use
HtmlDocument doc = new HtmlDocument();
//doc.OptionReadEncoding = false; - i comment this as it have no help too
HtmlWeb web = new HtmlWeb();
web.AutoDetectEncoding = false; // this must help to pass encoding, but it does not work!
doc = web.Load("");

and got
'WINDOWS-1259' is not a supported encoding name.
Parameter name: name

in HtmlDocument.cs line _declaredencoding = Encoding.GetEncoding(charset);

What i am going wrong?
How to pass AutoDetectEncoding (and use default or utf-8) ?
Jan 1, 2007 at 1:44 PM
Well, apparently, the WINDOWS-1259 does not seem to be known by the .NET Framework classes you're using (I have no idea whether they should).

You could catch the error or pre process the document before it's parsed.
Jan 11, 2007 at 6:13 PM
but for what this AutoDetectEncoding?
HtmlAgilityPack.HtmlWeb browser = new HtmlAgilityPack.HtmlWeb();
browser.AutoDetectEncoding - ????