Indeed, the encoding can be set on individual StringParts.

setCharSet method or add the third parameter for the constructor of
StringPart.

I stated my charset to be ISO-8859-1 and this resolved the issue of the
recipient server not being able to parse the value properly.

james

-----Original Message-----
From: James Sangster [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 18, 2005 11:12 AM
To: commons-user@jakarta.apache.org
Subject: [httpclient] multipart/form-data post character encoding of string
parts


Hi,
 
I have build a generic function which returns a PostMethod, which is
constructed from an array of StringPart and FilePart objects.   It is
possible that this PostMethod could be constructed entirely of StringPart
objects, depending opun the task it has been assigned to create (it was
written for generic use, but that may be the kicker here).
 
My problem right now is with special characters (for example, some of the
french accented characters).  When I issue this multipart/form-data
PostMethod, the recipient server is not picking up these special characters
(it's turning them into the ? character).
 
Is it possible for me to set the character encoding on each string part? Or
is there something else going on here that I'm not taking into account?
 
One thing I have tried is to URLEncoder.encode each StringPart value with
the charset of ISO-8859-1, but the recipient server makes an even bigger
mess of the request than without trying to do the encoding.
 
Any help on this is greatly appreciated.
 
Thanks,
james


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

Reply via email to