hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Non-ascii filenames in Multipart POST
Date Tue, 26 Feb 2008 08:34:36 GMT

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: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message