Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9159843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:35:32+00:00 2026-06-17T13:35:32+00:00

I use the following code to send files from my server to the client:

  • 0

I use the following code to send files from my server to the client:

Response.AppendHeader("content-disposition", "attachment; filename=" + FileName);
Response.ContentType = MimeType;
Response.WriteFile(PathToFile);
Response.End();

This works fine. Problem is, that when I download files from Internet Explorer, special characters, like the danish æ, ø and å, gets interpreted wrong. So i file with the name ‘Test æ ø å file.txt’ downloads as ‘Test æ_ø_Ã¥ file.txt’

I´ve tried adding Byte Order Mark to the response:

byte[] BOM = { 0xEF, 0xBB, 0xBF };
Response.BinaryWrite(BOM);

And setting the charset:

Response.Charset = "UTF-8";
Response.ContentEncoding = System.Text.Encoding.UTF8;

But none if it helped.
This seems only to be a problem in Internet Explorer.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T13:35:34+00:00Added an answer on June 17, 2026 at 1:35 pm

    The headers doesn’t use the encoding of the content, so it won’t help to change the content encoding. There is a standard for specifying encoding for the header parameters, but it’s pretty new, so it won’t be fully supportred in all browsers:

    http://greenbytes.de/tech/webdav/rfc5987.html

    This is how you would encode the name:

    string FileName = "Test æ ø å file.txt";
    
    string name = String.Concat(Encoding.UTF8.GetBytes(FileName).Select(b => {
      if ((b >= 48 && b <= 57) || (b >= 65 && b <= 90) || (b >= 97 && b <= 122)) {
        return new String((char)b, 1);
      } else {
        return String.Format("%{0:x2}", b);
      }
    }).ToArray());
    
    Response.AppendHeader("content-disposition", "attachment; filename*=UTF-8''" + name);
    

    The text ending up in the header would look like this:

    attachment; filename*=UTF-8''Test%20%c3%a6%20%c3%b8%20%c3%a5%20file%2etxt
    

    Note: The code encodes all characters except alphanumeric. That works, but not all other characters need encoding. You could evolve the code to leave a few more characters unencoded, after checking the standards.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to write Python code to send a file from client to server.
I use the following code... $mail = new PHPMailer(); $mail->IsSMTP(); // send via SMTP
Whenever I use the following code, the webserver (running IIS 7) refuses to send
I`m trying to send e-mail via c# and use the following code: public static
The following code runs a socket server on a thread. The client socket sends
I have the following code on the client side for retrieving data from the
I use following code: Create a retry policy, when error, retry after 1 second,
I just use following code to add an image to my project, var paper
I use VS2010, C# to develop Silverlight 4 app, I use following code in
I have an array of objects, and i use following code to get in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.