c# - Convert "iso-8859-1" to "utf-8" with HTML Agility Pack and xpath -
i'm trying piece of web page, have problem special characters. how convert data obtain correct reading? website use iso 8859-1 , must use utf 8.
string url = "http://www.ta-meteo.fr/troyes.htm"; htmlweb web = new htmlweb(); htmldocument doc = web.load(url); htmlnode bulletinmatin = doc.documentnode.selectsinglenode("//*[@id='blockdetday0']/div[1]/p[1]"); messagebox.show(bulletinmatin.innertext);
thanks.
i solved problem
string url = "http://www.ta-meteo.fr/troyes.htm"; encoding iso = encoding.getencoding("iso-8859-1"); htmlweb web = new htmlweb() { autodetectencoding = false, overrideencoding = iso, }; htmldocument doc = web.load(url); htmlnode bulletinmatin = doc.documentnode.selectsinglenode("//*[@id='blockdetday0']/div[1]/p[1]"); messagebox.show(bulletinmatin.innertext);
Comments
Post a Comment