I\'m using the StreamReader class in .NET like this:
using( StreamReader reader = new StreamReader( \"c:\\somefile.html\", true ) { string filetext = rea
Libary http://www.codeproject.com/KB/recipes/DetectEncoding.aspx
And perhaps a useful thread on stackoverflow
Use Win32's IsTextUnicode.
In the general sense, it is a difficult promlem. See: http://blogs.msdn.com/oldnewthing/archive/2007/04/17/2158334.aspx.