解决Response.AddHeader中文乱码问题

1 string filename = HttpUtility.UrlEncode(Encoding.UTF8.GetBytes("培训班自然情况表"));
2 Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}.doc", filename + System.DateTime.Now.ToString("yyyymmddhhmmssfff ")));
3 Response.Charset = "UTF-8";
4 Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8");
5 Response.ContentType = "application/ms-word";
6 Response.BinaryWrite(ms.ToArray());

 

posted on 2018-10-22 09:41  Insein  阅读(670)  评论(0编辑  收藏  举报

导航