Possible Duplicate:
How can I decode HTML characters in C#?
I have a problem converting string below strToCheck from html-encoded version to its actual UTF-8 representation.
// Code sample:
string result = null;
// HTML-encoded Input String (From Google Translate API) , renders "भारत महान देश है." in Hindi language.
string strTocheck = "भारत महान देश है.";
using (var sw = new StreamWriter(File.Open(@"c:\myfile.txt", FileMode.OpenOrCreate), Encoding.UTF8)) // UTF-8 encoding
{
sw.WriteLine(strTocheck);
}
System.IO.StreamReader reader = new System.IO.StreamReader(@"c:\myfile.txt", Encoding.UTF8); // UTF-8 encoding
result = reader.ReadToEnd();
MessageBox.Show(result);
// I expected "भारत महान देश है."
// But got output : भारत महान देश है.
Any help will be highly appreciated. Thank you.
Image here (please open it in a new tab) >> https://i.stack.imgur.com/xcctU.png