查msdn有几个关于encode的,用utf-16的试试。 我也遇到这个问题,从局域网的一台主机向另一台主机发送信息,也使用RichTextBox,用的ASCIIEncoding,但是如果用中文发送另一端接受到的就是一串????,后来看msdn才晓得它only support character values between u+0000 and u+007f。现在正打算用utf-16。
StreamReader srRead = new StreamReader("c:\\abc.txt",System.Text.Encoding.Default); string strText = srRead.ReadToEnd(); srRead.Close();
能给个新的吗?谢谢。
StreamReader srRead;
srRead = new StreamReader((System.IO.Stream)File.OpenRead(filename),System.Text.Encoding.Default);
srRead.BaseStream.Seek(0, SeekOrigin.Begin);
string strText = srRead.ReadToEnd();
srRead.Close();
http://www.csdn.net/expert/topic/388/388192.xml?temp=.5050928那次我的QQ公仔寄到北京去了:)
还有一只好漂亮的公仔女孩,肥嘟嘟的。舍不得送了。
我也遇到这个问题,从局域网的一台主机向另一台主机发送信息,也使用RichTextBox,用的ASCIIEncoding,但是如果用中文发送另一端接受到的就是一串????,后来看msdn才晓得它only support character values between u+0000 and u+007f。现在正打算用utf-16。
string strText = srRead.ReadToEnd();
srRead.Close();