StreamWriter输出中文乱码的问题

近期在学习C#,在用到StreamWriter输出中文到文件发现了一些乱码的问题.
解决如下
将一般的:
outFile = new StreamWriter ("c:\\abc.txt",false);
该成
outFile = new StreamWriter ("c:\\abc.txt",false, Encoding.GetEncoding("gb2312") );
outFile.WriteLine("中文");
输出中文就没问题了;

Published At
Categories with Web编程
Tagged with
comments powered by Disqus