Problem: Content-Disposition: attachment, with non-ASCII filename

Discussion in 'ASP .Net' started by Costas Andriotis, Oct 15, 2004.

  1. This is rather a IE-specific problem, but maybe someone has a solution. The HTTP headers are correct (Gecko for example understands and downloads/saves the file correctly) but IE does the wrong thing depending on the code:

    sf = "Non-ASCII but valid filename.extension"
    Response.AppendHeader("Content-Disposition", "attachment; filename=""" & sf & """")

    proposes and saves under a UTF-8-encoded filename.

    Response.AppendHeader("Content-Disposition", "attachment; filename=""" & Server.UrlPathEncode(sf) & """")

    proposes a seemingly correct filename which, once saved on the disk, is UrlEncoded.

    In both cases, if the filename is over a certain length, the filename is lost and IE proposes something random like CAC9QZGT.aspx. Changing the ContentEncoding/Charset of the response has no effect on the proposed filename.

    Any ideas on how to solve this? I can't ask the users not to save the files using greek filenames...

    I'd appreciate if you also cc any replies to my e-mail address.

    TIA
    Costas Andriotis
     
    Costas Andriotis, Oct 15, 2004
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. hunt n peck

    Attachment Disposition Bug

    hunt n peck, Aug 14, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    391
    hunt n peck
    Aug 14, 2003
  2. ben
    Replies:
    0
    Views:
    1,219
  3. =?Utf-8?B?R1JF?=
    Replies:
    1
    Views:
    3,608
    Craig Deelsnyder
    Aug 20, 2004
  4. =?Utf-8?B?SmVk?=

    Content-Disposition Doesn't Set Filename in IE

    =?Utf-8?B?SmVk?=, Apr 6, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    14,296
    =?Utf-8?B?SmVk?=
    Apr 8, 2005
  5. Sergio Juan
    Replies:
    1
    Views:
    1,214
    mohammad.h.ashmawi
    Apr 29, 2011
  6. =?ISO-8859-15?Q?Bernard_Delm=E9e?=

    mail attachment with non-ascii name

    =?ISO-8859-15?Q?Bernard_Delm=E9e?=, Dec 11, 2005, in forum: Python
    Replies:
    2
    Views:
    423
    =?ISO-8859-1?Q?Bernard_Delm=E9e?=
    Dec 12, 2005
  7. Ed
    Replies:
    10
    Views:
    50,889
    alok000707
    Jul 13, 2010
  8. bruce
    Replies:
    38
    Views:
    647
    Mark Lawrence
    Nov 1, 2013
Loading...