StreamReader srAsciiFromStream = new StreamReader(
        (System.IO.Stream)File.OpenRead("C:\\Temp\\Test.txt"),
        System.Text.Encoding.Default);

解决方案 »

  1.   

    设置encoding=Default;using System;
    using System.IO;class Test 
    {
        
        public static void Main() 
        {
            string path = @"c:\temp\MyTest.txt";        try 
            {
                if (File.Exists(path)) 
                {
                    File.Delete(path);
                }            using (StreamWriter sw = new StreamWriter(path)) 
                {
                    sw.WriteLine("This");
                    sw.WriteLine("is some text");
                    sw.WriteLine("to test");
                    sw.WriteLine("Reading");
                }            using (StreamReader sr = new StreamReader(path,System.Text.Encoding.
    Default)) 
                {
                    //This is an arbitrary size for this example.
                    char[] c = null;                while (sr.Peek() >= 0) 
                    {
                        c = new char[5];
                        sr.Read(c, 0, c.Length);
                        //The output will look odd, because
                        //only five characters are read at a time.
                        Console.WriteLine(c);
                    }
                }
            } 
            catch (Exception e) 
            {
                Console.WriteLine("The process failed: {0}", e.ToString());
            }
        }
    }
      

  2.   

    System.Text.Encoding.Default
    System.Text.Encoding.GetEncoding("GB2312")
      

  3.   


     这个问题一般可以调整StreamReader实例的 System.Text.Encoding 参数来解决,
     可以试一下这两个:System.Text.Encoding.Default
                       System.Text.Encoding.UTF8
      

  4.   

    String path="C:\\myfile.txt";
    StreamReader sr =new StreamReader((System.IO.Stream)File.OpenRead(path),System.Text.Encoding.GetEncoding("GB2312"));
      

  5.   

    出了自己的语言你用啊  你没用过易语言吗不也是soso的一个东西吗
      

  6.   

    这个这个正如以上各位所述,确实是编码的问题!你可以试着用.Net自带的那些编码格式转换一下试试!我这几天也是这个问题!呵呵1