1

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?

1 Answer 1

2

You need to pass the encoding to the StreamReader constructor, which parses your file's bytes.

Sign up to request clarification or add additional context in comments.

1 Comment

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.