views:

613

answers:

2

My company runs a webmail service, and we were trying to diagnose a problem with Word downloads not opening automatically - the same *.doc file download from Yahoo Mail would open, but one from ours would not.

In the course of investigating the headers we saw this coming from Yahoo:

content-disposition attachment; filename*="utf-8''word document.doc";

Whereas our headers were like this:

content-disposition attachment; filename="word document.doc";

What exactly is Yahoo doing with the additional asterisk and utf-8'' designation?

A: 

What Mime-Type are you using?

The asterisk is required as per RFC 2183 (http://www.ietf.org/rfc/rfc2183.txt):

In the extended BNF notation of [RFC 822], the Content-Disposition header field is defined as follows:

 disposition := "Content-Disposition" ":"
                disposition-type
                *(";" disposition-parm)

 disposition-type := "inline"
                   / "attachment"
                   / extension-token
                   ; values are not case-sensitive

 disposition-parm := filename-parm
                   / creation-date-parm
                   / modification-date-parm
                   / read-date-parm
                   / size-parm
                   / parameter

 filename-parm := "filename" "=" value

 creation-date-parm := "creation-date" "=" quoted-date-time

 modification-date-parm := "modification-date" "=" quoted-date-time

 read-date-parm := "read-date" "=" quoted-date-time

 size-parm := "size" "=" 1*DIGIT

 quoted-date-time := quoted-string
                  ; contents MUST be an RFC 822 `date-time'
                  ; numeric timezones (+HHMM or -HHMM) MUST be used
Alphager
The asterisk is indicating repetition from 0 to infinity, not a literal character
Greg
> What Mime-Type are you using?We were using the correct Mime-Type, application/msword. The original download problem was solved by providing a correct filesize (it was incorrect).
z7q2
+2  A: 

I think the correct answer to this is in rfc 2231:

Asterisks ("*") are reused to provide the indicator that language and character set information is present and encoding is being used. A single quote ("'") is used to delimit the character set and language information at the beginning of the parameter value. Percent signs ("%") are used as the encoding flag, which agrees with RFC 2047.

Specifically, an asterisk at the end of a parameter name acts as an indicator that character set and language information may appear at the beginning of the parameter value. A single quote is used to separate the character set, language, and actual value information in the parameter value string, and an percent sign is used to flag octets encoded in hexadecimal. For example:

    Content-Type: application/x-stuff;
     title*=us-ascii'en-us'This%20is%20%2A%2A%2Afun%2A%2A%2A
z7q2