IE and Firefox demands different encoding behavior on filename in content-disposition header.
IE : URL encoded using UTF-8
FF : RFC2047 (I tested it using UTF-8 and quoted-printable)
As JSF and Trinidad does not depend on Javamail, we may need to add a local copy of MIME encode function into Trinidad.
Please note on two known issues:
1. FF does not work well with open file
Tested using FF 220.127.116.11. Using the proposed behavior above,
- it works well with "save as", the non-ascii filename can be saved to file system successfully
- however, open does not work still.
2. IE has a short length limit. The total length, including the temp directory path + encoded filename, cannot be longer than around 290 bytes. Considering UTF-8 URL encoding is used here, for example one Chinese character will be encoded using 9 bytes... So some calculation here...
Default temp directory path = C:\Documents and Settings\<username>\Local Settings\Temporary Internet Files\, it my own env, it takes 80 bytes already.
290-80/9 ~ 23 Chinese characters max
To make this better, we may use the client side file system encoding to native encode the filename in header, for example, using windows-1252. However, there is no easy way to detect this.