Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Problem: Content-Disposition: attachment, with non-ASCII filename

Thread Tools

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

Costas Andriotis
Posts: n/a
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.

Costas Andriotis

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
The filename set in the response.setHeader("Content-Disposition", "attachment; filename=test.csv") is being ignored! Ed Java 10 07-13-2010 12:43 PM
Re: filename.gif or filename.gif.jpg? Beauregard T. Shagnasty HTML 1 05-30-2008 01:23 PM
Stitch rar files ( filename.part01 and filename.part02) Please help ixgor Software 1 10-15-2006 02:33 AM
how to get 8.3 format filename from long filename Java 1 06-15-2006 10:39 AM
Extract filename from a filename typed by user =?Utf-8?B?Sm9l?= ASP .Net 1 08-23-2004 11:29 PM