中文显示乱码怎么办?Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
中文显示乱码怎么办?Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
问题点数:20、回复次数:6Top
1 楼ztx998(学习ing)回复于 2004-04-01 07:42:48 得分 1
<globalization
requestEncoding="gb2312"
responseEncoding="gb2312"
fileEncoding="gb2312"
/>
web.config中改成这个试试Top
2 楼hychieftain(不同)回复于 2004-04-01 07:49:17 得分 1
再加上Server.UrlEncode(file.name)函数试试Top
3 楼restartboy(追梦)回复于 2004-04-01 07:54:29 得分 8
你试试下面的几个方法看看
web.config中
方法1.xml version="1.0" encoding="gb2321"
方法2.<globalization responseEncoding="gb2312" requestEncoding="gb2312" />
.aspx
方法3.<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
Top
4 楼super76(瞻云听雨)回复于 2004-04-01 09:01:00 得分 8
如果是文件名乱码,试试下面的:
string httpHeader="attachment;filename="+HttpUtility.UrlEncode(strFileName+".xls");
Response.AppendHeader("Content-Disposition", httpHeader);
如果是文件内容乱码,试试下面的:
Response.ContentEncoding=System.Text.Encoding.Default;
或
Response.ContentEncoding=System.Text.Encoding.GetEncoding("GB2312");Top
5 楼darkzhan(飞)回复于 2004-04-01 09:01:50 得分 1
Server.UrlEncode(file.name)Top
6 楼wacle([Smile!])回复于 2004-04-01 09:04:40 得分 1
HttpContext.Current.Server.UrlEncode(file.name)Top





