cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <>
Subject Re: trouble with request.setCharacterEncoding('UTF-8')
Date Sat, 26 Jun 2004 10:50:04 GMT
On 16.06.2004 13:30, Helmut Ackermann wrote:

> I have a jsp-page that creates a html-form everything UTF-8 encoded.
> Now I want to read the request parameter (send with method post) UTF-8
> encoded, but it seems that the paramters fetched within the jsp and
 > some helper java classes will always use the ISO-8859-1 encoding
 > to transform the request data into java strings.

Yes, ISO-8859-1 is the default behaviour.

> Now I tried to set 
> 'container-encoding' (init-parm in cocoon's web.xml) to UTF-8

You must not set this, this has to be ISO-8859-1.

> and
> 'form-encoding' (init-parm in cocoon's web.xml) to UTF-8

This is the correct one to change the behaviour.

> but it seems to have no effect.

I don't know exactly if the access from JSP to the request object 
directly the above configuration has effect or if it is just for Cocoon 
internally. You can test it for example using the RequestGenerator.

> In addition before and after calling
> 'request.setCharacterEncoding("UTF-8");'
> the method 'request.getCharacterEncoding();'
> always returns 'null' - strange isn't it

Before: No, that's not strange. That's a known behaviour of all recent 
browsers, they don't set the header.

> The java class behind the request seems to be
> 'org.apache.cocoon.components.jsp.JSPEngineServletRequest'

After: Yes, that's strange. Looking at the source [1], last method, you 
see that the encoding is not set in the wrapper. I don't know why it was 
done that way. Maybe because for avoiding wrong settings. I.e. when 
setting only 'form-encoding' correctly it maybe works and with setting 
it via setCharacterEncoding() you might break it again.

> Please help me, is there any other parameter, which I have overlooked for
> reading UTF-8 endoded form values.

No, probably only one to much :)



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

View raw message