cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stefan pickschneider <stefan.pickschnei...@s1998.tu-chemnitz.de>
Subject Re: Encoding Problem: File Upload and UTF-8
Date Sun, 06 Mar 2005 19:46:04 GMT
Bertrand Delacretaz wrote:
> Le 5 mars 05, à 15:17, stefan pickschneider a écrit :
> 
>> ..we have a problem with the encoding, cforms and file uploads.
> 
> 
> Did you look at http://wiki.apache.org/cocoon/RequestParameterEncoding ?
> It might give some answers.
> 
> -Bertrand

Hello,

thanks for your suggestion - it helped me to find a "solution".

It seems that the cocoon servlet initializes the container-encoding for 
the request too late, so that the default encoding iso-8859-1 is used 
for reading the parameters. These are incorrectly decoded, since 
container-encoding and form-encoding are set to UTF-8 in web.xml.
All forms etc. are UTF-8, too.
This problem only happens if you're using "application/x-www-
form-urlencoded" as enctype. For "multipart/form-data" it works, because
MultipartHttpServletRequest doesn't try to decode parameters.

Solution:
In CocoonServlet.java around line 1040 insert
         // set encoding before parameters are accessed
         request.setCharacterEncoding(this.containerEncoding);
before
	// Get the cocoon engine instance
         getCocoon(request.getPathInfo(), 			
	request.getParameter(Constants.RELOAD_PARAM));


Hope someone needs it and it is not too dirty ;-)
Stefan.





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message