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 9188983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:08:34+00:00 2026-06-17T20:08:34+00:00

On my web email server, users can download attachments off their email. When they

  • 0

On my web email server, users can download attachments off their email.

When they receive a file name that is not in English, the text gets broken in IE 8/9, but it comes out totally fine in Chrome/Firefox. Here is the code that currently handles the download:

<%
    attachfile = request("file")%>
<%
    files = Split(attachfile,"\")
    Set fso = CreateObject("Scripting.FileSystemObject")

    Response.Clear
    'Response.CharSet="UTF-8" 
    Response.ContentType = "application/unknown"
    Response.AddHeader "Pragma", "no-cache"
    Response.AddHeader "Expires", "0"
    Response.AddHeader "Content-Transfer-Encoding", "binary"
    Response.AddHeader "Content-Disposition","attachment; filename = " & files(Ubound(files)) 

    Set objStream = Server.CreateObject("ADODB.Stream")
    objStream.Open

    objStream.Type = 1 
    objStream.LoadFromFile attachfile

    Response.BinaryWrite objStream.Read
    Response.Flush

    objStream.Close : Set objStream = nothing

    Set fso = Nothing
%>
</BODY>
</HTML>

So then I changed how the filename was being passed in the content-disposition to the following, hoping in vain that it would encode the string in UTF-8 correctly before saving on the client’s computer:

Response.AddHeader "Content-Disposition","attachment; filename = " & Server.URLEncode(files(Ubound(files))) 

Now I’ve solved one problem but I am faced with two new problems -_-

The first problem is that filename no longer gets broken when I download the file in IE 8/9 but it adds a weird [1] or [2] at the end of the file extension. So if I had 파일 1.docx, IE would save the document as 파일 1.docx[1]

The second problem is that in chrome, the browser takes the UTF-8 encoded string literally so it gets saved as 파일%20%1.docx. Note that the non-english part of the file is displayed properly but the empty space shows up as Unicode Character Code 20.

How do I go about solving this issue?

  • 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-17T20:08:35+00:00Added an answer on June 17, 2026 at 8:08 pm

    Solution

    The most browser-compatible approach seems to be to put the desired filename into the url, rather than the Content-Disposition response header.

    For example:

    http://localhost/[webpage]/파일.docx
    

    When the user clicks on the link above, it will save the correct filename. The following is from IE 8:

    IE 8 file download prompt

    So the question becomes – how do you get asp to recognize a url with the above format? The answer is that you use a url re-writer.

    • For IIS 7 and above, there is the official re-write module from Microsoft.
    • For IIS 6, you can use the latest versions (2.x) of the Ionics Isapi Rewrite Filter. Microsoft recommends this for older IIS versions.
    • For IIS 5, you can also use the Ionics Isapi Rewrite Filter, however you might have to use the (1.x) versions. To download an older version, see the “other downloads” section on the right hand side of the link. The documentation doesn’t seem consistent in saying which IIS version is supported by which version of the filter.

    If you are using IIS 4 or older, I strongly suggest you upgrade.

    I don’t have a lot of experience using URL re-writers, but I was able to get the Microsoft one working easily enough. I used the wizard to add a user-friendly rule:

    Add user-friendly rule dialog

    The rule itself was easy enough:

    IIS re-write rule settings

    As you can see, I am creating a rule that rewrites

    http://localhost/default2/foo.doc/
    http://localhost/default2/foo.doc (also works)
    

    to

    http://localhost/default2.asp?f=foo.doc
    

    When the web page (default2.asp) is called, it can grab the filename from the url parameter f.

    Unrelated to your question, but you may also want to do some authentication to make sure that only the proper users have access to the file links, and therefore to your files.

    Sources

    How to encode the filename parameter of Content-Disposition header in HTTP?

    How to encode UTF8 filename for HTTP headers? (Python, Django)

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

Sidebar

Related Questions

You've probably seen web apps that have an email dropbox. Users can send email
I need an app/service I can put on our web server (LAMP) that will
I'm currently running a web-app that will send emails to users when they sign-up,
I have a web page that sends email to multiple users (online distribution list).
Our dovecot and email server authenticate users using SHA1 digests. We can't really change
I have a web app that only registered users can use, therefore I should
I have a web application that uses the CDO Message object to email reports.
I'm building a web app that relies quite heavily on email notification/responses. I obviously
I'm architecting a web service where users can update, for example, a blog by
I am building a web app using CakePHP that will allow users to create

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.