AJAX异步通信到*.ashx一般处理程序时,传递中文将出现乱码。
在aspx页面中的JS代码中进行编码:
var fileName = "测试test"; fileName = escape(fileName); //传值编码,中文时有用
在一般程序程序页面(*.ashx) 解码:
context.Response.ContentType = "text/plain"; //context.Response.Charset = "utf-8"; string name = HttpContext.Current.Server.UrlDecode(context.Request["name"]); //上传文件姓名,。解码