C#创建TXT文本文件产生乱码的问题
FileStreamf=newFileStream(Server.MapPath("ConfigSiteInfo.txt"),FileMode.OpenOrCreate)...
FileStream f = new FileStream(Server.MapPath("ConfigSiteInfo.txt"),FileMode.OpenOrCreate);
StreamWriter SW = new StreamWriter(f,Encoding.GetEncoding("gb2312"));
SW.WriteLine(“文本”);
SW.Flush();
SW.Close();只以GB2312编码,怎么解决? 展开
StreamWriter SW = new StreamWriter(f,Encoding.GetEncoding("gb2312"));
SW.WriteLine(“文本”);
SW.Flush();
SW.Close();只以GB2312编码,怎么解决? 展开
1个回答
2013-06-08
展开全部
StreamWriter SW = new StreamWriter(f,Encoding.GetEncoding("gb2312"));
改为StreamWriter SW = new StreamWriter(f,Encoding.Default);试试。
改为StreamWriter SW = new StreamWriter(f,Encoding.Default);试试。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询