Reputation: 59
I'm using HTMLAGILITYPACK to extract all of data from a HTML local page but still have problem with special characters ... look it: https://prnt.sc/p7xegw (I can't use ~,`,´,ç and others).
This is my code to call my HTML page:
System.IO.StreamReader myFile = new System.IO.StreamReader("C:/Users/Dev-02/Desktop/Daniel/xml_project/schemaproject/portal.html");
string arquivohtml = myFile.ReadToEnd();
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(arquivohtml);
Is there a way to set my encoding while I'm calling my HTML page?
Upvotes: 1
Views: 129
Reputation: 888185
You need to pass the encoding to the StreamReader
constructor, which parses your file's bytes.
Upvotes: 2