StreamReader sr = new StreamReader(FileName, System.Text.Encoding.GetEncoding("GB2312"))
String line;
while ((line = sr.ReadLine()) != null) 
  {
this.textBox1.Text += line;
   }
 

解决方案 »

  1.   

    我知道用Encoding, 但是具體不會, 望大俠不吝賜教
      

  2.   


    下面的示例演示了如何创建新的 UTF8Encoding 实例,它指定在编码时不发出 Unicode 字节顺序标记前缀,而且当检测到无效编码时将引发一个异常。此构造函数的行为和 UTF8Encoding 的默认构造函数的不同之处在于,后者在检测到无效编码时不会引发异常。
    using System;
    using System.Text;class UTF8EncodingExample {
        public static void Main() {
            UTF8Encoding utf8 = new UTF8Encoding();
            UTF8Encoding utf8ThrowException = new UTF8Encoding(false, true);        // This array contains two high surrogates in a row (\uD801, \uD802).
            // A high surrogate should be followed by a low surrogate.
            Char[] chars = new Char[] {'a', 'b', 'c', '\uD801', '\uD802', 'd'};        // The following method call will not throw an exception.
            Byte[] bytes = utf8.GetBytes(chars);
            ShowArray(bytes);        try {
                // The following method call will throw an exception.
                bytes = utf8ThrowException.GetBytes(chars);
            } catch (Exception e) {
                Console.WriteLine("Exception raised. \nMessage: {0}", e.Message);
            }
        }    public static void ShowArray(Array theArray) {
            foreach (Object o in theArray) {
                Console.Write("[{0}]", o);
            }
            Console.WriteLine();
        }
    }
      

  3.   

    EncoEncoding里可以转吧~~
    帮你up吧,希望有人帮你。
      

  4.   


    换下面的:StreamReader srMyfile = new StreamReader(fsMyfile,System.Text.Encoding.UTF8);
      

  5.   

    static void Main(string[] args)
    {  string line;
    string fsMyfile=@"e:\lin.txt";
    StreamReader srMyfile = new StreamReader(fsMyfile,System.Text.Encoding.Default );

    while((line=srMyfile.ReadLine ())!=null)
    {
    Console.WriteLine (line);
    }
    Console.ReadLine (); encoding 为default 就可以正常显示了.