I have a string (C# code) that looks as follows:
string s = "Indsætning";
It is encoded in some way that I am not sure of.
I’d like to decode it so that I get the following string:
Indsætning
I have tried with
string s1 = HttpUtility.UrlDecode(s);
string s2 = HttpUtility.HtmlDecode(s);
However, I don’t get the string that I am looking for.
Any help is appreciated.
Convert the string to bytes and then using the Encoding class to get the
UTF-8string representation.Edit – As mentioned in the comments, this assumes that the string being converted is of a particular encoding (Latin-1 in this case). Therefore, it won’t necessarily work for all strings, unless you know that they’ve all been encoded into the same format.