StreamWriter输出中文乱码的问题
来源:互联网 发布:决策树经典算法 编辑:程序博客网 时间:2024/04/25 16:24
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
近期在学习C#,在用到StreamWriter输出中文到文件发现了一些乱码的问题.
解决如下
将一般的:
outFile = new StreamWriter ("c:/abc.txt",false);
该成
outFile = new StreamWriter ("c:/abc.txt",false,Encoding.GetEncoding("gb2312"));
outFile.WriteLine("中文");
输出中文就没问题了;
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
- StreamWriter输出中文乱码的问题
- StreamWriter输出中文乱码的问题
- StreamWriter输出中文乱码的问题
- StreamWriter输出中文乱码
- StreamReader和StreamWriter中文乱码问题
- PHP输出中文乱码的问题
- 解决HttpServletResponse输出的中文乱码问题
- PHP输出中文乱码的问题
- 解决HttpServletResponse输出的中文乱码问题
- 解决HttpServletResponse输出的中文乱码问题
- PrintWriter输出中文乱码的问题
- PHP输出中文乱码的问题
- 解决HttpServletResponse输出的中文乱码问题
- 解决HttpServletResponse输出的中文乱码问题
- PrintWriter输出中文乱码的问题
- 解决HttpServletResponse输出的中文乱码问题
- PHP 输出简单的中文 乱码问题
- zend studio输出中文乱码的问题
- DataSet的使用
- 写一个通用数据访问组件
- 嵌套使用 datalist
- 比较购物 火爆有因
- 使用XPathExpression类对XML进行排序
- StreamWriter输出中文乱码的问题
- Delphi 7前瞻:将Delphi作为ASP.NET的脚本语言(下)
- 基于UNIX的操作系统内核——Cocoa中的Distributed Object
- 如何进行 比较购物
- Web Service描述语言 WSDL 详解(2)
- Ns4_obj结构
- Ubuntu下用Firefox来安装软件!
- Web Service描述语言 WSDL 详解(4)
- 10.3.1 服务端