ASP tutorial. NET to prevent the download of Chinese file names appear garbled
Prevent the download file name in Chinese name and appear garbled available UrlEncode
*/
//
Response.AddHeader ("Content-disposition", "Attachment;filename=" +server.urlencode ("www.111cn.net Chinese. rar"));
/*
In the ASP.net tutorial Server.URLEncode used the encoding method is UTF8
So when we pass the characters, we find that the results are different from the ASP.
The solution is Httputility.urlencode, and you can specify how he encodes it.
such as Httputility.urlencode ("kanji", encoding.default) gets the encoding of the system's current ANSI code page
About UrlEncode
The UrlEncode method applies the URL encoding rule, including the escape character, to the specified string.
Grammar
Server.URLEncode (String)
Parameters
String
Specifies the string to encode.
Example
Script
<%response.write (Server.URLEncode ("Http://www.111cn.net"))%>
Output
Http%3a%2f%2fwww%2111cn%2enet