Response Chinese file name garbled problem under firefox/ie solution

Source: Internet
Author: User

Under firefox/ie response Chinese file name garbled problem solution font: [Increase decrease] type: Reprint

Only for the case of no space and IE use Response.appendheader () if you want to output a file without encoding in Firefox, and IE, the output of the file name Hollow lattice is not a + number, it is more than once judged, next will be detailed introduction of interested friends can understand the next That might help you. And found a lot of people in the garden handling response. Download the file name using this method
Response.appendheader ("Content-disposition", "attachment;filename=" + httputility.urlencode (FileInfo.Name, SYSTEM.TEXT.ENCODING.UTF8));
But this is only for the absence of spaces and IE in the case of use.
If you want to output a file that is not encoded in Firefox, and the file name of IE output is not a + number, it will be judged more than once.
Copy CodeThe code is as follows:
if (HttpContext.Current.Request. Useragent.tolower (). IndexOf ("MSIE") >-1)
{
DownloadFileName = Httputility.urlpathencode (downloadfilename);
}
if (HttpContext.Current.Request. Useragent.tolower (). IndexOf ("Firefox") >-1)
{
Response.AddHeader ("Content-disposition", "attachment;filename=\" "+ downloadfilename +" \ ");
}
Else
{
Response.AddHeader ("Content-disposition", "attachment;filename=" + downloadfilename);
}

Enables the server to gather information about the browser functionality that is running on the client. The following code is common code, and other specific information is provided in MSDN.

HttpBrowserCapabilities B = request.browser;
Response.Write ("Browser name and version number:" + B.type + "<br>");
Response.Write ("Name:" + b.browser + "<br>");
Response.Write ("version:" + b.version + "<br>");
Response.Write ("Operating platform:" + b.platform + "<br>");
Response.Write ("Support frame:" + b.frames + "<br>");
Response.Write ("Support table:" + b.tables + "<br>");
Response.Write ("Whether Cookies are supported:" + b.cookies + "<br>");

Browser name and version number: IE6
Name: IE
Version: 6.0
Operating platform: WinXP
Whether frame is supported: True
Whether table is supported: True
Whether to support Cookies:true

Response Chinese file name garbled problem under firefox/ie solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.