当前位置:编程学习 > C#/ASP.NET >>

请问下 如何输出一个html页面 是gb2312编码的

            StreamReader sr = File.OpenText(Server.MapPath(""));
            string temp = sr.ReadToEnd();
            sr.Close();
            temp = temp.Replace("[title]", ds.Tables["news"].Rows[0][2].ToString());
            temp = temp.Replace("[sub]", ds.Tables["news"].Rows[0][3].ToString());
            temp = temp.Replace("[datetime]", ds.Tables["news"].Rows[0][1].ToString());
            StreamWriter sw = new StreamWriter(Server.MapPath());
            sw.Write(temp);
            sw.Close();

我本来的代码是这样的  想取数据库一些字符讲原html gb2312编码的页面里某些符号替换
但是直接这样出来是乱码 请问该如何改动。。。
谢谢 --------------------编程问答-------------------- temp = System.Text.Encoding.GetEncoding("GB2312"); --------------------编程问答-------------------- 1楼的可以
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,