用程序生成了一个html页,上一半是乱码,怎么办~ 如图:这个问题怎么解决?请教各位大神! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 看不图,一般贴 图没用,贴HMTL代码吧 代码就是很简单的html语句,一条一条的数据显示出来,还是放上来吧,<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8 "/><meta name="description" content="" /><meta name="keywords" content="" /></head><body><img src="/images/logo.jpg" /><p> <a href="SiteMaps_2.html">下一页 </a> <hr> <a target="_blank" href="#">不过如此 </a>崔永元 华艺出版社 2001-7-1 0:00:00 <br> <a target="_blank" href="#">比尔·盖茨日记 </a>比尔.G 山西古籍出版社 2000-1-1 0:00:00 <br> <a target="_blank" href="#">WTO入世手册新世纪中国人经济生存指南 </a>周志新 中国华侨出版社 2000-1-1 0:00:00 <br> <a target="_blank" href="#">萧乾散文 </a>傅光明 选编 浙江文艺出版社 2007-10-1 0:00:00 <br> <a target="_blank" href="#">夏菁散文 </a>夏菁 浙江文艺出版社 1999-5-1 0:00:00 <br> <a target="_blank" href="#">沈从文作品集 </a>米歇尔.约尔格斯 云南人民出版社 2000-10-1 0:00:00 <br> <a target="_blank" href="#">张继高散文 </a>张继高 浙江文艺出版社 2000-1-1 0:00:00 <br> <a target="_blank" href="#">周作人散文精编 </a>钱理群 浙江文艺出版社 1994-10-1 0:00:00 <br> <a target="_blank" href="#">陈原散文 </a>陈原著 浙江文艺出版社 1997-2-1 0:00:00 <br> <a target="_blank" href="#">无名氏散文 </a>无名氏 浙江文艺出版社 1998-11-1 0:00:00 <br> <a target="_blank" href="#">朱自清作品精选 </a>彰军 广西师范大学出版社 2000-1-1 0:00:00 <br> <a target="_blank" href="#">丁玲作品精选 </a>萧启明 广西师范大学出版社 2000-1-1 0:00:00 <br> <a target="_blank" href="#">中国古典文化精华-蒙学经典(上下) </a>许积德/吴圣楣/柳启沛 京华出版社 2000-1-1 0:00:00 <br>等等重复的数据 然后,在web.confing全盘指定DG2312编码 应该是编码问题,utf-8 不行的话试下charset=gb2312。 去掉utf-8重新生成下,还不行就用gb312 检查生成HTML的功能代码,指定输出的文件类型及格式 写文件时用utf-8编码 方式写入。using System;using System.Collections.Generic;using System.Text;using System.IO;using System.Text.RegularExpressions;/// <summary> /// 写文件主方法 /// </summary> /// <param name="Path">文件路径</param> /// <param name="Text">文件内容</param> public static void Writer(string Path, string Text) { ToHelper.Writer(HttpContext.Current.Server.MapPath(Path), Text, "utf-8"); } /// <summary> /// 写入文件 /// </summary> /// <param name="Path">文件路径</param> /// <param name="Text">写入内容</param> /// <param name="Coding">文件编码</param> public static void WriterFile(string Path, string Text, string Coding) { try { sw = new StreamWriter(Path, false, Encoding.GetEncoding(Coding)); sw.WriteLine(Text); sw.Flush(); sw.Close(); } catch (Exception e) { throw new Exception(e.Message, e); } } /// <summary> /// 写文件主方法 /// </summary> /// <param name="Path">文件路径</param> /// <param name="Text">文件内容</param> public static void Writer(string Path, string Text) { WriterFile(HttpContext.Current.Server.MapPath(Path), Text, "utf-8"); } /// <summary> /// 写入文件 /// </summary> /// <param name="Path">文件路径</param> /// <param name="Text">写入内容</param> /// <param name="Coding">文件编码</param> public static void WriterFile(string Path, string Text, string Coding) { try { sw = new StreamWriter(Path, false, Encoding.GetEncoding(Coding)); sw.WriteLine(Text); sw.Flush(); sw.Close(); } catch (Exception e) { throw new Exception(e.Message, e); } } Coding="gb2312";new StreamWriter(Path, false, Encoding.GetEncoding(Coding)); 请问如何用JS获取某个网页的一段文字? 弹出窗体 一条SQL语句 及待高手:登陆的时候,输完密码,按回车直接激发事件的问题????非常奇怪!!! 怎样安全和性能好一点?? 消息框里的中文是乱码,求解决办法! 高分求问: 用DATAGRID可以生成这样的表吗?生成后如何把它导入到EXCEL或word呢? 急!(在线等待) 急需ASPNetMenu注册码 有关DATASET的问题! cakephp里面怎么实现城市动态联动查询!!高手请帮忙!!! 导出Excel,在框架里面无效
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8 "/>
<meta name="description" content="" /><meta name="keywords" content="" />
</head><body><img src="/images/logo.jpg" /><p>
<a href="SiteMaps_2.html">下一页 </a>
<hr>
<a target="_blank" href="#">不过如此 </a>崔永元 华艺出版社 2001-7-1 0:00:00 <br>
<a target="_blank" href="#">比尔·盖茨日记 </a>比尔.G 山西古籍出版社 2000-1-1 0:00:00 <br>
<a target="_blank" href="#">WTO入世手册新世纪中国人经济生存指南 </a>周志新 中国华侨出版社 2000-1-1 0:00:00 <br>
<a target="_blank" href="#">萧乾散文 </a>傅光明 选编 浙江文艺出版社 2007-10-1 0:00:00 <br>
<a target="_blank" href="#">夏菁散文 </a>夏菁 浙江文艺出版社 1999-5-1 0:00:00 <br>
<a target="_blank" href="#">沈从文作品集 </a>米歇尔.约尔格斯 云南人民出版社 2000-10-1 0:00:00 <br>
<a target="_blank" href="#">张继高散文 </a>张继高 浙江文艺出版社 2000-1-1 0:00:00 <br>
<a target="_blank" href="#">周作人散文精编 </a>钱理群 浙江文艺出版社 1994-10-1 0:00:00 <br>
<a target="_blank" href="#">陈原散文 </a>陈原著 浙江文艺出版社 1997-2-1 0:00:00 <br>
<a target="_blank" href="#">无名氏散文 </a>无名氏 浙江文艺出版社 1998-11-1 0:00:00 <br>
<a target="_blank" href="#">朱自清作品精选 </a>彰军 广西师范大学出版社 2000-1-1 0:00:00 <br>
<a target="_blank" href="#">丁玲作品精选 </a>萧启明 广西师范大学出版社 2000-1-1 0:00:00 <br>
<a target="_blank" href="#">中国古典文化精华-蒙学经典(上下) </a>许积德/吴圣楣/柳启沛 京华出版社 2000-1-1 0:00:00 <br>等等重复的数据
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
/// <summary>
/// 写文件主方法
/// </summary>
/// <param name="Path">文件路径</param>
/// <param name="Text">文件内容</param>
public static void Writer(string Path, string Text)
{
ToHelper.Writer(HttpContext.Current.Server.MapPath(Path), Text, "utf-8");
}
/// <summary>
/// 写入文件
/// </summary>
/// <param name="Path">文件路径</param>
/// <param name="Text">写入内容</param>
/// <param name="Coding">文件编码</param>
public static void WriterFile(string Path, string Text, string Coding)
{
try
{
sw = new StreamWriter(Path, false, Encoding.GetEncoding(Coding));
sw.WriteLine(Text);
sw.Flush();
sw.Close();
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
}
/// 写文件主方法
/// </summary>
/// <param name="Path">文件路径</param>
/// <param name="Text">文件内容</param>
public static void Writer(string Path, string Text)
{
WriterFile(HttpContext.Current.Server.MapPath(Path), Text, "utf-8");
}
/// <summary>
/// 写入文件
/// </summary>
/// <param name="Path">文件路径</param>
/// <param name="Text">写入内容</param>
/// <param name="Coding">文件编码</param>
public static void WriterFile(string Path, string Text, string Coding)
{
try
{
sw = new StreamWriter(Path, false, Encoding.GetEncoding(Coding));
sw.WriteLine(Text);
sw.Flush();
sw.Close();
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
}
Coding="gb2312";
new StreamWriter(Path, false, Encoding.GetEncoding(Coding));