Convert "& aring;" "& ouml;" to its normal representation

c# character-encoding html-agility-pack iso-8859-1

Question

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?

Accepted Answer

Use the HttpUtility.HtmlDecode method

HttpUtility.HtmlDecode("å"); // Ã¥

Popular Answer

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



Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why