I temporary fixed my problem but simply create my own class based on FilePart and I changed this method:
/**
* Write the disposition header to the output stream
* @param out
* The output stream
* @throws IOException
* If an IO problem occurs
*/
protected void sendDispositionHeader( OutputStream out ) throws IOException {
super.sendDispositionHeader( out );
// Now handle the write part String filename = source.getFileName(); if( filename != null ) { out.write( FILE_NAME_BYTES ); out.write( super.QUOTE_BYTES ); out.write( *filename.getBytes()* ); out.write( super.QUOTE_BYTES ); } }
I use filename.getBytes() as filename instead of HttpConstants.getAsciiString(). I don't know if this is ok or not for Http Standard but it works well. With this little fix, I can send file with Latin characters.
But I'll monitor the bug so I can use a httpClient package class instead of my own class.
Stéph
Oleg Kalnichevski wrote:
Stéphane,
You can monitor the following bug report in order to track the progress of this feature implementation.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24504
Cheers,
Oleg
On Mon, 2004-01-12 at 19:45, Stéphane Houle wrote:
Thank you Oleg & Mark for your help!!!
I'll write a workaround FilePart that do not convert the filename to us-ascii!!!
Oleg:
if you fix the problem, can you send an email to me or to the mailing list please! Thanks!
Steph
Oleg Kalnichevski wrote:
Is it a requirement that Disposition Header be in ASCII?
Yep. See RFC2183 <http://www.faqs.org/rfcs/rfc2183.html> and RFC1521 <http://www.faqs.org/rfcs/rfc1521.html> for details
<quote> Current [RFC 2045] grammar restricts parameter values (and hence Content-Disposition filenames) to US-ASCII. We recognize the great desirability of allowing arbitrary character sets in filenames, but it is beyond the scope of this document to define the necessary mechanisms. We expect that the basic [RFC 1521] `value' specification will someday be amended to allow use of non-US-ASCII characters, at which time the same mechanism should be used in the Content-Disposition filename parameter.
</quote>
PS: As soon as I have a breathing moment I may contribute quote-printable codec to Commons-codec, which would allow us to take care of the problem
Cheers
Oleg
-Mark
Stéphane Houle wrote:
Hi everyone,
I'm very sorry to send an email directly to all of you but I saw your emails in the MultipartPostMethod source code in HttpClient 2.0 RC2. Maybe you can or cannot answer to my question, if not, do you know a mailing list or a person how can answer to my question ??
Here's my question:
I'm using MultipartPostMethod to send a file, everything works well but when the filename contains French character like "é", the character is always converted to ?. I though it was the encoding that was setted to US-ASCII or something like that but no, the encoding is setted to ISO-8859-1. I tried all sort to method to send the file:
- set the File object - set the File object with the filename - set a FilePart - set a FilePart with a FilePartSource
Nothing works, here is a little dump of my Part:
FILE: /home/lhoule/dev/ac-httpClient-1.0/fileTest/toté.mp3 PART 0: ISO-8859-1 PART 0: binary PART 0: application/octet-stream PART 0: file PART 0: ----------------314159265358979323846
I don't know what I can do... I try to search the web for a solution or in jakarta website... Nothing... Did you ever have this kind of problem?? Or maybe I don't use the MultipartPostMethod correctly to support French character??
Any clue?
Thank you very much and sorry again to send an email directly to all of you!
Steph
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]