Save dialog specifies incorrect default name when special characters in Content-Disposition header

RESOLVED EXPIRED

Status

Core Graveyard
File Handling
RESOLVED EXPIRED
14 years ago
2 years ago

People

(Reporter: Simon Lesage Tremblay, Unassigned)

Tracking

({intl})

Trunk
Other
Linux

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

14 years ago
User-Agent:       Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
Build Identifier: Mozilla/5.0 (X11; U;Linux i686; en-US;rv:1.6) Gecko/20040113

We currently develop a web site that support multi language. We create a 
download servlet that set the header Content-Disposition with <attachment; 
filename="myfile.pdf">.  The name of the file (myfile.pdf) can contain special 
characters like "é" or ":" for example.   So we want to know if it be possible 
to specifiy a default file names which include non-ASCII characters?

We know the standard RFC2183 (Content-Disposition) specifies the use of ASCII 
character for the Content-Dispositon header parameters.  However, we want to 
know whether there is any other way of getting Mozilla to specify the non-ASCII 
default file name.

For more info, see Standard RFC2183 link (see section 2.3)
http://xml.resource.org/public/rfc/html/rfc2183.html

Reproducible: Always
Steps to Reproduce:
1.We set the header Content-Disposition to attachment; 
filename="fichiernommé:2004:02:10:23:10:52.pdf"  (This is the name of the file 
on the hard disk on Linux)
2.We send the page with this header
3.The browser open a dialog box with a filename "DownloadServlet"

Actual Results:  
Currently, the server is on Linux and when the browser see these special 
characters, the save dialog show the name of our servlet (DownloadServlet) and 
not the name of the file.

Expected Results:  
The browser should suggest to save the file with the same name as the "file" 
parameter in the Content-Disposition header.

Updated

14 years ago
Assignee: general → file-handling
Component: Browser-General → File Handling
QA Contact: general → ian
Summary: Save dialog specifies incorrect default name when special characters in Content-Disposition header → Save dialog specifies incorrect default name when special characters in Content-Disposition header
http://www.ietf.org/rfc/rfc2231.txt is the best way to specify non-ascii headers

mozilla falls back to 
http://www.ietf.org/rfc/rfc2047.txt I believe

I thought we had a fallback to the origin charset as well... jshin?

Comment 2

14 years ago
(In reply to comment #0)

> Expected Results:  
> The browser should suggest to save the file with the same name as the "file" 
> parameter in the Content-Disposition header.

cbie is right. Anyway, you have to use 'filename' parameter (NOT 'file'
parameter). Mozilla checks both 'filename' and 'name' parameters for RFC 2231,
RFC 2047 and 'raw', but never checks 'file' parameter which _nobody_ is supposed
to use.

(Reporter)

Comment 3

14 years ago
(In reply to comment #2)
> cbie is right. Anyway, you have to use 'filename' parameter (NOT 'file'
> parameter). Mozilla checks both 'filename' and 'name' parameters for RFC 2231,
> RFC 2047 and 'raw', but never checks 'file' parameter which _nobody_ is 
supposed
> to use.

Sorry, we wanted to say that we use the filename parameter and his value is the 
name of the file.  This name can be chinese characters and/or special 
characters like é and : .

Comment 4

14 years ago
(In reply to comment #3)

> Sorry, we wanted to say that we use the filename parameter and his value is the 
> name of the file.  This name can be chinese characters and/or special 
> characters like é and : .

  If you have Chinese characters and Latin letters with diacritic marks, you
have to use UTF-8 in which you can represent every single character of (major)
writing system in the world. If you don't have ':', you may just use it as the
value of 'filename' parameter (although it's not a sanctioned way, Mozilla will
understand. I'm not sure how MSIE deals with it). 

  The html authors didn't their homework in the file upload (this part is not
specified clearly) so that we have to follow the specification for internet
mail, which is RFC 2231. [1] Mozilla can handle RFC-2231-encoded filename
parameter well. However, MSIE doesn't understand it last time I checked. To work
around it, you may use RFC 2047-style encoding for 'name' with MIME charset
UTF-8. Mozilla understands RFC 2231-style encoding, RFC 2047-style encoding,
raw-8bit strings in the character encoding of the page and finally UTF-8. In
your case (presumably your page will be in UTF-8), the last two would collapse
to the single case (both UTF-8). In the last two cases, ':' would be problematic
and you have to replace it with something else. 

Anyway, bugzilla is not a place to teach you how to deal with this problem. If
you have an example case where Mozilla doesn't work as described above, please,
give me the URL. 


[1] A recent working draft of WHATWG also left out this issue, about which I'll
 alert them. 
Keywords: intl
This is an automated message, with ID "auto-resolve01".

This bug has had no comments for a long time. Statistically, we have found that
bug reports that have not been confirmed by a second user after three months are
highly unlikely to be the source of a fix to the code.

While your input is very important to us, our resources are limited and so we
are asking for your help in focussing our efforts. If you can still reproduce
this problem in the latest version of the product (see below for how to obtain a
copy) or, for feature requests, if it's not present in the latest version and
you still believe we should implement it, please visit the URL of this bug
(given at the top of this mail) and add a comment to that effect, giving more
reproduction information if you have it.

If it is not a problem any longer, you need take no action. If this bug is not
changed in any way in the next two weeks, it will be automatically resolved.
Thank you for your help in this matter.

The latest beta releases can be obtained from:
Firefox:     http://www.mozilla.org/projects/firefox/
Thunderbird: http://www.mozilla.org/products/thunderbird/releases/1.5beta1.html
Seamonkey:   http://www.mozilla.org/projects/seamonkey/
This bug has been automatically resolved after a period of inactivity (see above
comment). If anyone thinks this is incorrect, they should feel free to reopen it.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → EXPIRED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.