How to guess the encoding of a file with no BOM in .NET?

前端 未结 8 620
野趣味
野趣味 2020-12-14 13:07

I\'m using the StreamReader class in .NET like this:

using( StreamReader reader = new StreamReader( \"c:\\somefile.html\", true ) {
    string filetext = rea         


        
相关标签:
8条回答
  • 2020-12-14 14:06

    Libary http://www.codeproject.com/KB/recipes/DetectEncoding.aspx

    And perhaps a useful thread on stackoverflow

    0 讨论(0)
  • 2020-12-14 14:06

    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.

    0 讨论(0)
提交回复
热议问题