C# HtmlAgilityPack HtmlDocument() LoadHtml encoding -


uri url = new uri("http://localhost/rgm.php"); webclient client = new webclient(); string html = client.downloadstring(url);  htmlagilitypack.htmldocument doc23 = new htmlagilitypack.htmldocument(); doc23.loadhtml(html);  htmlnode body23 = doc23.documentnode.selectsinglenode("//body");  string content23 = body23.innerhtml; 

how can force parse web page "utf-8" encoding?

use downloaddata method of webclient instead of downloadstring():

webclient client = new webclient(); var data = client.downloaddata(url); var html = encoding.utf8.getstring(data); 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -