当前位置: 代码迷 >> ASP.NET >> 模板页面的中文内容,生成HTML页面时,出现乱码了?解决方法
  详细解决方案

模板页面的中文内容,生成HTML页面时,出现乱码了?解决方法

热度:9216   发布时间:2013-02-26 00:00:00.0
模板页面的中文内容,生成HTML页面时,出现乱码了????
<title> </title> 中的内容,显示时是乱码

------解决方案--------------------------------------------------------
加上 <meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 "> 试试
------解决方案--------------------------------------------------------
你这么生成的?
------解决方案--------------------------------------------------------
你在存文件时,应该加汉字编码
------解决方案--------------------------------------------------------
将Web.config里面的
<requestEncoding= "utf-8 "
responseEncoding= "utf-8 "
/>

requestEncoding= "gb2312 "
responseEncoding= "gb2312 "
/>


------解决方案--------------------------------------------------------
请使用
StreamWriter writer = new StreamWriter(@ "path:\xx.htm ",false,System.Text.Encoding.GetEncoding( "GB2312 "));

生成
writer.Write(sssssssss);
------解决方案--------------------------------------------------------
将一般的:
outFile = new StreamWriter(@ "path:\xx.htm ",false);
改成
outFile = new StreamWriter(@ "path:\xx.htm ",false,Encoding.GetEncoding( "gb2312 "));
outFile.WriteLine( "中文 ");
outFile.Close();
------解决方案--------------------------------------------------------
VS2005里面的高级保存,改变保存编码
  相关解决方案