Using the HtmlAgilityPack I came across a html page that gave an exception at HtmlWeb.cs in function Get. When the line respenc = System.Text.Encoding.GetEncoding(resp.ContentEncoding); was executing and resp.ContentEncoding is "gzip" an exception is thrown say gzip is not a supported encoding name.This is how I solved the problem:try{respenc = System.Text.Encoding.GetEncoding(resp.ContentEncoding);}catch (Exception){respenc = null;}and when getting the responsestream:if (resp.ContentEncoding.ToLower().Contains("gzip"))s = new GZipStream(s, CompressionMode.Decompress);Now the code also works with gzip compressed pages.Would it be possible to solve this in the offcial code?
Just change the following lines in HtmlWeb.cs - line 433
if ((resp.ContentEncoding != null) && (resp.ContentEncoding.Length>0)) { try { respenc = System.Text.Encoding.GetEncoding(resp.ContentEncoding); } catch { respenc = null; } } else { respenc = null; }
I hope this will be usefull...