Error occur in method System.Globalization.EncodingTable.internalGetCodePageFromName

Topics: Developer Forum
Jul 19, 2011 at 9:26 AM

Hello,

I've tried finding other discussions about this subject but unable to find any answer for this issue.

The problem is that when I try loading an html with an unrecognized Encoding I get the following error : 

Error occur in method System.Globalization.EncodingTable.internalGetCodePageFromName at line 0. ErrorMessage: 'utf-8       ' is not a supported encoding name.

I know the problem is with the 'utf-8       ' but I can't change the original html page so I have to deal with what I got.

I tried a few solutions in the code regarding the following code:

HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument();

htmlDoc.OptionReadEncoding = false;

htmlDoc.Load(fileName,Encoding.UTF8); or htmlDoc.Load(fileName,Encoding.UTF8,false); etc'.......

I'm using the latest version of the package (1.4).

Did anyone had this problem? Any solution??? Please assist urgently!!!

Thanks,

Anat.