commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guy Katz <>
Subject RE: [FileUpload] character encoding problem (URGENT! PLZ HELP!)
Date Sun, 08 Aug 2004 07:50:47 GMT
i had the same problem over the weekend indirectly using the fileupload JSF
component based on commons-upload.
to my understanding, commons-fileupload does not support proper encoding of
form fields that are not files.
i tweaked the source code, and put an encoding filter in front of my web app
but it did not do the trick.
i think this is an important feature missing from this project.
there is a very well known stable package alternative which accepts an
encoding parameter to the multipart/form-data parser and  works great

-----Original Message-----
From: Jason Lea []
Sent: Friday, August 06, 2004 4:37 PM
To: Jakarta Commons Users List
Subject: Re: [FileUpload] character encoding problem (URGENT! PLZ HELP!)

If the content is a file it should just be base64 encoded or something, 
so it can be saved using the FileUpload component's methods.  But form 
fields would suffer encoding problems, and so too would the filename of 
the file.  Here are some ideas:

You need to set the page encoding when you send it to the browser so it 
knows what encoding you are using.
Such as (in a .jsp page)

<%@ page contentType="text/html; charset=UTF-8"%>

Or in java (I think):  response.setContentType("text/html; charset=UTF-8");

When you receive the request you can force the encoding too. 

The request can also have the encoding set on it.   

I guess you could try each of those.   Replace UTF-8 with what ever 
encoding you are using.

Jérémie LOPEZ wrote:

>Thanks for answering...
>Well, I tried it (with "iso-8859-1", not "UTF-8", but it should give the
>same results for my problem I suppose), and it didn't work.
>Btw, from the javadoc, it just sets the encoding for the header of the
>request parts, not the content...
>-----Message d'origine-----
>De : Jason Lea [] 
>Envoyé : vendredi 6 août 2004 16:09
>À : Jakarta Commons Users List
>Objet : Re: [FileUpload] character encoding problem (URGENT! PLZ HELP!)
>I would assume you do something like this:
>DiskFileUpload upload = new DiskFileUpload();
>(I haven't tried it myself.)
>Jérémie LOPEZ wrote:
>>Hi all,
>>I'm using the Commons FileUpload in a webapp hosted on a unix server.
>>When a windows client uploads a text file with accented characters, 
>>they're replaced by '?' or 'ý'...
>>I suppose I must specify some character encoding or that sort of thing, 
>>but where and what exactly?
>Jason Lea
>To unsubscribe, e-mail:
>For additional commands, e-mail:

Jason Lea

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

View raw message