vs2005/vs2008的基础应用(2)
来源:互联网 发布:sql server id自增 编辑:程序博客网 时间:2024/05/22 09:49
创建一个HTML/HTM页面的时候为避免乱码,必须在写入的内容里面加上对输入内容编码的格式:
a = ['<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />',
'<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">',
'<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />'
]
匹配:"<meta[ ]+http-equiv=["']?content-type["']?[ ]+content=["']?text/html;[ ]*charset=([0-9-a-zA-Z]+)["']?"
下面是创建一个HTML/HTM页面的c#代码:
if (File.Exists(HttpContext.Current.Server.MapPath("test.html")))
{
File.Delete(HttpContext.Current.Server.MapPath("test.html"));
}
FileStream fs = File.Create(HttpContext.Current.Server.MapPath("test.html"));
Byte[] info = new UTF8Encoding(true).GetBytes("<html><head><meta http-equiv='Content-Type' content='text/html;charset=utf-8'></head><body><h1>测试1HTML,编码正常了!</h1></body></html>");
fs.Write(info, 0, info.Length);
fs.Close();
a = ['<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />',
'<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">',
'<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />'
]
匹配:"<meta[ ]+http-equiv=["']?content-type["']?[ ]+content=["']?text/html;[ ]*charset=([0-9-a-zA-Z]+)["']?"
下面是创建一个HTML/HTM页面的c#代码:
if (File.Exists(HttpContext.Current.Server.MapPath("test.html")))
{
File.Delete(HttpContext.Current.Server.MapPath("test.html"));
}
FileStream fs = File.Create(HttpContext.Current.Server.MapPath("test.html"));
Byte[] info = new UTF8Encoding(true).GetBytes("<html><head><meta http-equiv='Content-Type' content='text/html;charset=utf-8'></head><body><h1>测试1HTML,编码正常了!</h1></body></html>");
fs.Write(info, 0, info.Length);
fs.Close();
- vs2005/vs2008的基础应用(2)
- vs2005/vs2008的基础应用(1)
- vs2008与vs2005的冲突
- vs2005和vs2008的区别
- VS2008向VS2005的转换
- vs2008与vs2005的冲突
- VS2005打开VS2008的项目
- VS2005打开VS2008的解决方案
- VS2005打开VS2008的项目
- vs2005打开vs2008的方法
- VS2008的转换到vs2005
- vs2005与vs2008的转化
- VS2005打开VS2008项目的2种方法(转)
- VS2008:AjaxPro.2 的应用
- VS2008针对VS2005的性能改进
- 离开vs2005使用VS2008的充分理由
- 关于 vs2008 与 vs2005 的冲突问题
- 让vs2005支持vs2008的sln工程
- VC++.net 整合开发环境使用技巧
- sql语句优化工具LECCO SQL Expert
- 测试标题
- IT之禅(十三)
- softcore -- CPU rasterization
- vs2005/vs2008的基础应用(2)
- [翻译]在SQL Server中使用CLR调用.NET方法(转)
- Request获取url几种方法的比较
- 关于PreparedStatement和Statement具体区别
- 一个比较全的的log4j配置文件(log4j.properties)转载
- QoBean的元语言系统(二)
- 三十而立如何成为准富人
- 英特尔加入广电阵营
- fopen