Detect the encoding of a text file using C#
问题 I have a set of markdown files to be passed to jekyll project , need to find the encoding format of them i.e UTF-8 with BOM or UTF-8 without BOM or ANSI using a program or a API . if i pass the location of the files , the files have to be listed,read and the encoding should be produced as result . Is there any Code or API for it ? i have already tried the sr.CurrentEncoding for stream reader as mentioned in Effective way to find any file's Encoding but the result varies with the result from a