If you ever need to get the Encoding of a document...
here is the code:
private static Encoding
GetEncoding(string
filename)
{
using (var reader =
new StreamReader(filename,
Encoding.Default, true))
{
if (reader.Peek() >= 0)
reader.Read();
return reader.CurrentEncoding;
}
}
Attribution:
https://www.codeproject.com/Tips/1231324/How-to-Get-a-Files-Encoding-with-Csharp
Comments
Post a Comment