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

  • Home
  • SEARCH
  • 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 8211069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:18:11+00:00 2026-06-07T10:18:11+00:00

I’ve been struggling to convert a html value of an attribute, without any success.

  • 0

I’ve been struggling to convert a html value of an attribute, without any success.

Here is the the HTML i am trying to convert (sure the charset will not be shown here, but, i see it exactly as you see it).

<a href="https://sistemas.usp.br/jupiterweb/listarGradeCurricular?codcg=12&amp;codcur=12012&amp;codhab=1&amp;tipo=N" target="_blank">Administração – São Paulo – diurno</a>

All right, the VALUE of this htmlnode is “Administração – São Paulo – diurno”.

I am using HtmlAgilityPack to parse the HtmlPage for this, and once i reach this node, its innerText value is just like this : Administração â São Paulo â diurno

I am assuming the original charset of the page is UTF-8 because thats what the encoding tag on the html says to me.

How can i convert this weird string to : Administração - São Paulo - Diurno ?

I’ve tried these threads already : thread one and thread two
and nothing solved my issue

EDIT: I am getting the page via a C# WebRequest Get.

EDIT2 : Added HtmlAgilityPack tag

The problem was isolated : WebRequest is messing the Html sometimes.

Is there any other way to set the encoding ? i am trying : _webReq.Encoding = “ISO-8859-1”

Thanks in advance

  • 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-06-07T10:18:12+00:00Added an answer on June 7, 2026 at 10:18 am

    After a small test, you can see that the string is not properly getting Encoded back to its original form.

    Sample test:

     var item = "Administração - São Paulo - Diurno";
     Console.WriteLine(item);
    
     var buffer = Encoding.UTF8.GetBytes(item);
     var item2 = Encoding.Default.GetString(buffer);
     Console.WriteLine(item2);
    

    This prints:

    Administraçao - Sao Paulo - Diurno
    AdministraA§A£o - SA£o Paulo - Diurno
    

    As you can see, the original string is being converted to bytes using UTF8, but then it is being converted back to a string using Default encoding.

    This is wrong.

    If WebRequest.GetResponse() is returning the string as the wrong value, then there is a problem with that method. Try setting the TransferEncoding property on the HttpWebRequest to UTF8.

    Before you can set the TransferEncoding property, you must first set the SendChunked property to true. Clearing TransferEncoding by setting it to null has no effect on the value of SendChunked. Values assigned to the TransferEncoding property replace any existing contents.

    Or you can try to set the Encoding to UTF8 on the StreamReader you open. Can I see your code?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
i got an object with contents of html markup in it, for example: string

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.