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

x-user-defined is not a supported encoding name.

Sep 27, 2010 at 11:55 AM


      I am trying to parse a html document having charset=x-user-defined. I am not able to parse this file and it gives an error like :

      x-user-defined is not a supported encoding name.
      Parameter name: name.

      Please help me to solve this problem and parse this document.


Sep 27, 2010 at 2:16 PM

Well considering x-user-defined is not a valid charset I would say just remove it from the html before parsing it. htmlstring.Replace("x-user-defined","utf-8") or just remove the charset attribute all together.

Sep 27, 2010 at 3:49 PM

Hi darthobiwan,

             Thanks for your reply.

             Just wanted to confirm that if i follow the way you suggested will it effect the parsing in any way?

Oct 11, 2010 at 11:48 AM

Any one knowing this issue please try to help.

Oct 25, 2010 at 11:43 AM

While parsing a URL i got the same problem but with a different encoding name i.e gzip.

Error Message: System.ArgumentException, 'gzip' is not a supported encoding name.

Can anyone provide a list of all unsupported encoding names.


May 21, 2011 at 3:09 PM
Edited May 21, 2011 at 3:17 PM

Hi darthobiwan,

I still have problems with the x-user-defined encoding.  Actually, i used the solution that you suggested but it seems to have adverse effects while loading a web document i.e we will not get the benefits of using WebDocument.Load() method (like detecting encoding etc).

Currently i use the following code to load a url:


Dim request As Net.HttpWebRequest = DirectCast(Net.WebRequest.Create(path), Net.HttpWebRequest)
Dim response As Net.HttpWebResponse = DirectCast(request.GetResponse(), Net.HttpWebResponse)

fs = New StreamReader(response.GetResponseStream)
fileContents = fs.ReadToEnd

Dim objHtmlDocument As New HtmlDocument

But with this approach, i get a WebException with status code 403:Forbidden for the specified url.

Now, if we load the same URL using a WebDocument.Load() then we get the following resultant HtmlDocument object:

Can you suggest how to solve this issue?