获取的网络流为乱码,请高手指教谢谢
telnet   连接到   172.18.0.1 
 显示:Username:   
 通过编程方式连接过去却显示乱码,请高手帮帮我吧   谢谢   
 private   void   button1_Click(object   sender,   EventArgs   e) 
                         { 
                                     TcpClient   t   =   new   TcpClient(AddressFamily.InterNetwork); 
                                     IPAddress   ip   =   IPAddress.Parse( "172.18.0.1 "); 
                                     t.Connect(ip,   23); 
                                     NetworkStream   stream   =   t.GetStream(); 
                                     Byte[]   buffer   =   new   Byte[32767]; 
                                     Int32   bytes   =   stream.Read(buffer,   0,   buffer.Length); 
                                     String   responseData   =   String.Empty; 
                                     responseData   =   System.Text.Encoding.ASCII.GetString(buffer,0,bytes); 
                                     Text   =   responseData.ToString(); 
                         }
------解决方案--------------------System.Text.Encoding.GetEncoding( "GB2312 ").GetString(buffer,0,bytes);       
 ***************************************************************************** 
 欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码)    
 最新版本:20070210   
 http://www.cnblogs.com/feiyun0112/archive/2006/09/20/509783.html
------解决方案--------------------System.Text.Encoding.GetEncoding   
 这个根据具体的情况 也可能是 UTF-8
------解决方案--------------------多试几种编码看看 
 responseData = System.Text.Encoding.UTF8.GetString(buffer,0,bytes);   
 responseData = System.Text.Encoding.Unicode.GetString(buffer,0,bytes); 
------解决方案--------------------Encoding.GetEncoding(1252)
------解决方案--------------------循环遍历所有Encode,找到适合你的encode 
 EncodingInfo[] encodes = System.Text.Encoding.GetEncodings(); 
  for (int i = 0; i  < encodes.Length; i++) 
  { 
     Console.WriteLine(encodes[i].Name +  " :  " + encodes[i].GetEncoding().GetString(data)); 
   }