Hi Oleg,

Appreciate the prompt response.

Do you know what the correct method is of sending filenames containing non-ascii chars?

From what I've read in http://www.faqs.org/rfcs/rfc1867.html:

   "if the file name of the client's operating system is not in
   US-ASCII, the file name might be approximated or encoded using the
   method of RFC 1522"

Which to me equates to encoding the filename using javax.mail.internet.MimeUtility.encodeText(). The software I'm uploading to however doesn't decode the filename. Neither do other upload servlets such as http://www.servlets.com/cos/ and http://commons.apache.org/fileupload/index.html.

Thanks
Andy Wu

Oleg Kalnichevski wrote:
On Mon, 2008-02-25 at 16:48 +0000, Andy Wu wrote:
Hi,

When making a multipart post uploading a file with a filename containing non-ascii characters, the filename appears to be incorrect written to the http request.

If you look at the code, sendDispositionHeader() essentially sends the filename.getBytes( "US-ASCII" ):

http://hc.apache.org/httpclient-3.x/xref/org/apache/commons/httpclient/methods/multipart/FilePart.html

However, the browsers I've tested with will send the filename.getBytes( "ISO-8859-1" ) version of the filename and thus the software that's I'm working with that receives the upload is decoding the filename correctly.

Would anyone else concur that this is a bug?


Andy,

This is definitely not a bug. Non-ASCII characters are not allowed to be
present in the MIME elements such disposition headers. Common browser
applications violate the MIME spec. Plain and simple.

For those who do not give a flying damn about standards compliance,
HttpClient as of release 4.0-alpha3 provides a browser compatibility
mode for multipart coded entities.
Hope this helps

Oleg

Thanks
Andy Wu

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to