最近这个项目中要用到导出报表到pdf文件的功能.在导出的过程中用到Response.AddHeader函数将http头添加到输出流的函数,即Response.AppendHeader("Content-Disposition", "attachment;filename=" + strfilename);这个时候,如果strfilename中含有中文字符,则在打开的文件保存对话框中文件名就是乱码,解决方法是将文件名进行url编码,即将如下写:
Response.AppendHeader("Content-Disposition", "attachment;filename=" + Server.UrlEncode("报表统计.pdf"));
这样就能保证文件保存时文件名不是乱码了.
Response.AddHeader函数中文件名的中文乱码问题的解决,布布扣,bubuko.com
Response.AddHeader函数中文件名的中文乱码问题的解决
原文:http://www.cnblogs.com/kevin1988/p/3586625.html