How to set encoding when using HtmlAgilityPack.HtmlDocument.LoadHtml

Topics: Developer Forum, Project Management Forum, User Forum
Aug 20, 2014 at 2:54 AM
Thread on SA : http://stackoverflow.com/questions/25395547/how-to-set-encoding-when-using-htmlagilitypack-htmldocument-loadhtml



I already have the source of HTML page so i am using
string html_page_source="bla bla some source";
HtmlDocument hdMyDoc = new HtmlDocument();
hdMyDoc.LoadHtml(html_page_source);
However i see not decoded characters such as
  
içerisinde 
göründüğünden çok
.
.
So how can i set auto decode at htmldocument ?

How can i set default encoding to solve this problem ?

And would this below method a good practice ?

hdMyDoc.LoadHtml(HttpUtility.HtmlDecode(html_page_source));

C# .net 4.5 latest , WPF application