用 System.Text.Encoding.Default 确省使用系统的编码 你的2000 Server是中文就可以吧
试一下把web.config的配置去掉如何?
试一下把web.config的配置去掉如何?
解决方案 »
- 一个简单的输出流问题(大家来看看)
- 我想做个搜索页面
- 能否在页面PostBack的时候判断是哪个控件触发了这次PostBack
- hashtable的问题。期待着能有人帮忙解决!先谢谢了!
- 一个很烦人的存储过程!!求高手
- 如何制作类似dreamware的框架结构?急!急!急!
- 象IE地址栏的下拉列表怎么做?急!~~~~~~~~~~~~~~~~~~
- 求助http缓存机制问题
- System.Net.WebException: 在 WebClient 请求期间发生异常,路径拒绝访问
- 请问可以在comparevalidator控件里出错信息用<script>alert("出错了")</scrpt>吗
- asp.net的奇怪的数据更新(c#)---几天了,没有搞定~~~
- 关于动态添加控件的问题,,迷惑我好久了,,帮我一下
responseEncoding="UTF-8" />
中的UTF-8改为GB2312
System.Web.HttpUtility.UrlEncode(ExportFileName, System.Text.Encoding.UTF8)
改为:System.Web.HttpUtility.UrlEncode(ExportFileName, System.Text.Encoding.GetEncoding("gb2312"))
<globalization requestEncoding="GB2312" responseEncoding="GB2312" />
而不能改成UTF-8,否则我的程序在取中文参数时会出错。你说的web.config配置去掉是什么意思?To freemanor(逍遥客) :我已经是这种环境,你可能没看清楚。
TO webdiyer(陕北吴旗娃): 你这种情况就等同于我的第2种情况,即“下载”对话框显示为乱码,“另存为”对话框显示正常。我现在需要两者一致。
我得代码:
Response.AppendHeader("Content-Disposition", "attachment;;filename=" + HttpUtility.UrlEncode(fileName));
Response.AppendHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode("文件", System.Text.Encoding.UTF8))
ExportFileName="2003年度分析报告.doc"
Response.Clear()
Response.ClearHeaders()
Response.Buffer = False
Response.ContentType = FileContentType
Response.AppendHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(ExportFileName, System.Text.Encoding.Default))
Response.WriteFile(FileName)
Response.Flush()
Response.Close()在Win98下乱码,在客户端Win2000及Win2003下弹出的“下载”对话框中乱码,但点击保存后会弹出一个“另存为”对话框的文件名位置显示正常。不知何故?
我的服务器web.config配置必须为
<globalization requestEncoding="GB2312" responseEncoding="GB2312" />
如果将
Response.AppendHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(ExportFileName, System.Text.Encoding.Default))
改成
Response.AppendHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(ExportFileName, System.Text.Encoding.GetEncoding("GB2312")))
那么“下载”对话框显示正常,但点击保存按钮后弹出一个“另存为”对话框,框中显示的文件名却为乱码。
请问有什么办法?
Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(ExportFileName))
<globalization requestEncoding="GB2312" responseEncoding="GB2312" culture="zh-CN" fileEncoding="GB2312" />
请大家再帮我看看。
Response.AppendHeader("Content-Disposition", "attachment;filename="+System.Web.HttpUtility.UrlEncode("人员表.xls",System.Text.Encoding.UTF8 ));
Response.ContentType="application/vnd.ms-excel";
Response.Charset="";
Response.WriteFile("人员表.xls");我得到的结果:全部都显示正常!!!!!!!!!!!!!!!下载对话框,文件中的内容都是正常的中文!