streamreader怎么读汉字不出现乱码??!

Firestone2003 2003-08-05 11:08:18
streamreader怎么读汉字不出现乱码?
...全文
89 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Firestone2003 2003-08-06
  • 打赏
  • 举报
回复
谢谢大家!
gxz01 2003-08-05
  • 打赏
  • 举报
回复
StreamReader sr=new StreamReader("c:\\1.txt",System.Text.Encoding.Default);
String input;
while((input=sr.ReadLine())!=null)
{
Console.WriteLine(input);
}
Console.WriteLine("The end of the Stream has been reched.");
sr.Close();
panyee 2003-08-05
  • 打赏
  • 举报
回复
StreamReader sr = new StreamReader("c:\\123.txt", System.Text.Encoding.GetEncoding("GB2312"));
string sResultContents = sr.ReadToEnd();
sr.Close();
TheAres 2003-08-05
  • 打赏
  • 举报
回复
看这个FAQ:

http://expert.csdn.net/Expert/FAQ/FAQ_Index.asp?id=15649

111,092

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧