And it is a bug of jboss-seam-excel ?
Can I submit is as a bug?
Cheers! : )
Forget it. It is not a bug. The implementation of the <e:workbook/> filename property is fine.
Because, I found there is no standard way to specify the Content-Disposition header value.
The encode of the content-disposition header value can only be ASCII. If the file name is non-ascii, then there is no portable way to encode it.
The Content-Disposition is defined in RFC2183, the header encoding is defined in RFC2047 and RFC2231.
In short, IE does not support RFC2231 but obey the RFC2047 well. While the Firefox does not obey the RFC2047 well but it support RFC2231.
So there is not a portable way to support non-ASCII character encoding of Content-Disposition header value, you have to use different encoding method for different browser.
Especially, there is no way to encode non-ASCII for the Safari.
See this link for detail information.
Below is my solution for Firefox and IE.
- Use FacesContext to get User-Agent.
- If the User-Agent contains 'MSIE' then the filename = new String(origFileName.getBytes(”GB18030″), “ISO8859-1″);
- For other case, the filename = MimeUtility.encodeText(origFileName);