用程序生成了一个html页,上一半是乱码,怎么办~如图:这个问题怎么解决?请教各位大神![解决办法]看不图,一般
用程序生成了一个html页,上一半是乱码,怎么办~
如图:
这个问题怎么解决?请教各位大神!
[解决办法]
看不图,一般贴 图没用,贴HMTL代码吧
[解决办法]
去掉这个charset=utf-8编码看看
[解决办法]
[解决办法]编码问题吧!
[解决办法]应该是编码问题,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);
}
}
[解决办法]C# codeCoding="gb2312";new StreamWriter(Path, false, Encoding.GetEncoding(Coding));
[解决办法]
格式
格式
格式
[解决办法]
你看打开IE右键 选择编码 试下几个编码看那个不是乱码,在程序里再调试下。
[解决办法]