commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Lea <ja...@kumachan.net.nz>
Subject Re: [FileUpload] character encoding problem (URGENT! PLZ HELP!)
Date Fri, 06 Aug 2004 14:36:36 GMT
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.   
request.setCharacterEncoding("UTF-8");

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 [mailto:jason@kumachan.net.nz] 
>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();
>
>
>upload.setHeaderEncoding("UTF-8");
>
>(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?
>>
>>TIA
>>
>>JimmyL.
>>
>> 
>>
>>    
>>
>
>
>--
>Jason Lea
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>  
>


-- 
Jason Lea



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message