Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6769697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:13:27+00:00 2026-05-26T15:13:27+00:00

I am using HtmlAgilityPack to read a parse a html file and extract some

  • 0

I am using HtmlAgilityPack to read a parse a html file and extract some text:

static void Main(string[] args)
        {
            var webGet = new HtmlWeb();
            var document = webGet.Load("http://port.ro/");

            var programs = from program in document.DocumentNode.Descendants()
                           where program.Name == "a" && program.Attributes["href"] != null && program.InnerText.Trim().Length > 0
                           select program.InnerText ;

            foreach (string s in programs)
            {
                Console.WriteLine(s);
            }

            Console.ReadLine();
        }

My problem is that the website contains characters like à and when I print them, they are replaced by ?.

What should I need to do so when I print the text the character à its replaced by a or print it like à ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:13:28+00:00Added an answer on May 26, 2026 at 3:13 pm

    Did you try using or set the encoding as required for the site. This should help you get the proper text

    var document = webGet.Load(“http://port.ro/“, Encoding.UTF8);//check your encoding

    Above one is for htmldocument

    for HtmlWeb
    Try this:

    var web = new HtmlWeb
    {
        AutoDetectEncoding = false,
        OverrideEncoding = myEncoding,
    };
    var doc = web.Load(myUrl);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to extract text from an HTML file using C#. I am trying
I'm using the HTMLAgilityPack to parse HTML pages. However at some point I try
I'm using HtmlAgilityPack to parse HTML. I want to check if an element has
I am using HtmlAgilityPack. I create an HtmlDocument and LoadHtml with the following string:
I've been using the HtmlAgilityPack to eat some XHTML documents, however, if I want
Im using HtmlAgilityPack/HAP so that I can use Xpath with HTML documents. I need
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net; using HtmlAgilityPack; namespace sss
I am lost in HTML DOM. Using HTMLAgilityPack, how would I navigate the following
I'm in need of some kind of library, possibly HTMLAgilityPack? that can parse a
With using c# 4.0 and htmlagilitypack how can i read values inside certain table.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.