commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Andersson>
Subject Re: Reading unicode characters from a form in multipart/form-data format
Date Tue, 06 May 2008 06:42:49 GMT
Hi there, if you don't get it solved with the new jar that you got from 
Song Jason youmight try to convert the text yourself.. (I have done this 
when I've been using commons fileupload.

what is happening is that commons fileupload is reading the text as if 
it was encoded in ISO-8859-1, so here is what I have been using to 
convert it to UTF-8

String name = ...   // get parameter from commons file upload
name =name.getBytes("ISO-8859-1"),"UTF-8");

Ylva Degerfeldt skrev:
> Hi everyone!
> I joined this list in hope of that someone can help me with this problem:
> Is there a way to use UTF-8 when reading from form fields with
> multipart/form-data format? (I'm using Apache commons
> ServletFileUpload so that's why I'm asking on this mailing list.)
> I've searched the web for answers and though this seems to be a well
> known problem, I haven't found any solution to it.
> I have to have a multipart/form-data form because I want the users to
> be able to save their names and birthdate on the same jsp page as
> where they can upload a (cv) file, so I have to find a solution.
> My jsp page has the meta tag attribute charset="UTF-8", the form has
> the attribute accept-charset="UTF-8" and in the servlet which receives
> this request I do a:
> request.setCharacterEncoding("UTF-8");
> but none of those things seem to help.
> I also tried using the setHeaderEncoding method of the
> ServletFileUpload class but that didn't help either. I still receive
> Swedish characters as "weird looking characters" and that's not what I
> want.
> If anyone has a solution to this problem I would be Very grateful!
> (Even if the solution means that I have to convert the strings I
> receive in some way.)
> Thanks in advance,
> Ylva
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message