Question

I know this question have been asked before but I still can't get any answers I find to work.

For example i have this string:

string myString = "Betrakta nedanstående figur";

And i want to decode it to:

string myString = "Betrakta nedanstående figur";

What is the best approach?

Was it helpful?

Solution

The string you have shown has strictly nothing to do with the ISO-8859-1 encoding. It's just a string containing HTML encoded entities. To decode it you could use the HttpUtility.HtmlDecode function:

string myString = "Betrakta nedanstående figur";
string myDecodedString = HttpUtility.HtmlDecode(myString);

Note that you will need to reference the System.Web assembly in order to use that method.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top