Hello,

I would like to know what exactly means "using the default character
encoding" for a FileItem getString() method:

*getString<http://jakarta.apache.org/commons/fileupload/apidocs/org/apache/commons/fileupload/FileItem.html#getString%28%29>
*()
         Returns the contents of the file item as a String, using the
default character encoding.

I was using FileUpload in the context of a form containing a file to be
uploaded. I noticed the characters (that were sent in UTF-8 by the client,
Firefox) were not received correctly on the server side. Actually FF was not
sending any headers saying that the encoding was UTF-8 (I checked this
fact).

However, I was surprised when I explicitly called setCharacterEncoding on
the HTTPServletRequest object. I was still getting garbled text. I had to
explicitly call getString("UTF-8") to get the correct result.

So what means using the default character encoding? I assumed it would take
the encoding of the underlying ServletRequest object, but apparently it is
not the case.

Thanks for any help,

Jean-Noël

Reply via email to