hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guillaume Cottenceau ...@mnc.ch>
Subject Re: MultipartPostMethod adn UTF-8 parameter content.
Date Tue, 09 Nov 2004 10:21:41 GMT
reudeml04 'at' free.fr writes:

> Hi All,
> 
> I am using HTTPClient 3.0a2 and I am trying to mimic the POST of a form to
> upload a binary file.
> The code I use is below:
> 
> MultipartPostMethod mPost = new MultipartPostMethod(addFileToPackageURL);
> File f1 = new File(fa.getFilePath() + "\\" + fa.getFileName());
> mPost.addParameter("upload_file",f1.getName(),f1);
> 
> It works fine for all files BUT when the filename contains non basic ASCII chars
> (like UTF-8), the received filename is transformed and unknow chars are changed
> to question marks ?.
> 
> It tried to add  mPost.addRequestHeader("Content-Type", "charset=\"UTF-8\"" );
> but it does not change anything.
> 
> How should I proceed to allow the submit of a filename like
> "note¯¯training¯abc.doc" so that it does not become
> "note??training?abc.doc" on the other end of the wire ?
> 
> Is this a bug or am I doing something wrong (likely :-)) ?
> 
> Any help or suggestion would be much appreciated.

It seems that javadoc explains that.

http://jakarta.apache.org/commons/httpclient/3.0/apidocs/org/apache/commons/httpclient/methods/MultipartPostMethod.html

"Field names originally in non-ASCII character sets may be
encoded using the method outlined in RFC 1522."

-- 
Guillaume Cottenceau

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


Mime
View raw message