I try to read string from a HTML file. Here is my code:
string result = File.ReadAllText(@"C:\temp\invoice.html", Encoding.UTF8);
Since the character set of the html file is charset=windows124, the result value does not come as utf-8
The result value contains;
�</span><br>BAH�EL�EVLER<span>
CodePudding user response:
Based on the location specified under your profile, I assume you mean windows-1254 (Turkish)?
Try:
Encoding turkishEncoding = Encoding.GetEncoding("windows-1254");
string result = File.ReadAllText(@"C:\temp\invoice.html", turkishEncoding);
For reference, see the encodings-list under: https://docs.microsoft.com/en-us/dotnet/api/system.text.encoding?view=net-6.0
