1

I'm loading a web page System.Net.WebClient. Page is in ISO-8859-1 encoding. If I write it to file and then open, I can see all characters normally.

But if I put this content into HtmlAgilityPack and then extract innerText property, I'm getting some special letter encoded as å and ö .

How to convert them to normal representation?

2 Answers 2

5

Use the HttpUtility.HtmlDecode method

HttpUtility.HtmlDecode("å"); // å
2
  • Thank you so much for this quick help!! Jul 31, 2011 at 20:48
  • As someone pointed out on another thread, this can be a problem because HttpUtility is located in System.Web.dll which can be a problem at least in the case of the .NET Framework 4 Client Profile which does not contains this assembly. The HtmlEntity.DeEntitize (see corvuscorax answer) method is included with the Html Agility Pack. Jul 31, 2011 at 22:36
0

You can call the HtmlEntity.DeEntitize method with the text string as the parameter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.