求救,ASP.net写文件问题
StreamReader srd;
srd = File.OpenText (file_path); //file_path为一目录下的HTML文件。
string strFile = null ;
while(srd.Peek ()!=-1)
{
strFile=srd.ReadToEnd();
}
srd.Close ();
strFile = strFile.Replace("$title$",newstitle);
strFile = strFile.Replace("$content$",newscontent);
strFile = strFile.Replace("$date$",newsdate);
strFile = strFile.Replace("$ip$",newsip);
strFile = strFile.Replace("$prev$",prevtitle);
strFile = strFile.Replace("$next$",nextitle);
strFile = strFile.Replace("$prevurl$",prevurl);
strFile = strFile.Replace("$nexturl$",nexturl);
StreamWriter fs=new StreamWriter(desfile,false);
fs.WriteLine (strFile); //strFile为要写入的目标HTML文件
fs.Close ();
大家帮我看看,我这段代码中文输出怎么是乱码呢, 主要是生成的HTML文件出现乱码。
问题点数:0、回复次数:0Top




