当前位置:首页
开发技术指南» 文章正文
    引言:

    摘要: 注意需要在程序中链接winmm.lib库,并且包含头文件"mmsystem.h"。 #include "mmsystem.h" typedef unsigned char byte byte * getdata(cstring *pstring) //获取声音文件数据的函数,pstring参数指向要打开的声音文件; { if (pstring==n......
    摘要: 我要做一个轰炸骗子手机的东东!如果做出来,共享源码 ......


StreamReader读出了乱码

System.Text.StringBuilder   sb   =   new   System.Text.StringBuilder();    
  string   line;    
  //读取模板内容    
  using(System.IO.StreamReader   sr   =   new   System.IO.StreamReader("C:\\template.html"))    
  {    
  while((line=sr.ReadLine())!=null)    
  {    
  sb.Append(line);    
  }    
  sr.Close();    
  }  
  Response.Write(sb.ToString());  
  Response.End();  
  居然都呈乱码显示了  
  template.html显示是正常的  
  什么原因会造成这样?

NO.1   作者: henryfan1

你要设置读取的编码,System.IO.StreamReader的构造函有很多版本,具体可以看MSDN的帮助.

NO.2   作者: shoutor

using(System.IO.StreamReader   sr   =   new   System.IO.StreamReader("C:\\template.html"),System.Text.Encoding.GetEncoding("gb2312")))    
   
 

NO.3   作者: cwwhy

new   System.IO.StreamReader("C:\\template.html"),System.Text.Encoding.GetEncoding("GB2312"))    
 

NO.4   作者: shoutor

Encoding.GetEncoding("gb2312"))


    摘要: 一个网站需要身份验证才能登陆,现在按如下步骤: 1,打开一个浏览器,打开这个网站 2,再打开一个浏览器,再打开这个网站 3,在第一个浏览器中登陆这个网站 4,在第2个浏览器中还需要登陆 如何才能做到在第2个浏览器中不需要再次登陆 ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE