Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Cocoon Wiki" for change 
notification.

The following page has been changed by AlexanderKlimetschek:
http://wiki.apache.org/cocoon/RequestParameterEncoding

------------------------------------------------------------------------------
  If your Cocoon application needs to read request parameters that could 
contain ''special'' characters, i.e. characters outside of the first 128 ASCII 
characters, you'll need to pay attention to what encoding is used.
  
  Normally a browser will send data to the server using the same encoding as 
the page containing the submitted form (or whatever). So if the pages are 
serialized using UTF-8, the browser will submit form data using UTF-8. The user 
can change the encoding, but it's quite safe to assume he/she won't do that 
(have you ever done it?).
+ 
+ ''In my browser this is the case, it is set in the preferences to ISO-8859-1 
and he encodes form parameters with that, regardless of the UTF-8 content type 
of the page containing the form. I can't remember when I did set this 
property... So what to do with this case? This means, it could be any 
encoding.'' -- AlexanderKlimetschek
  
  After doing some tests with popular browsers, I've noticed that usually 
browsers will not let the server know what encoding they used to encode the 
parameters, so we need to make sure ourselves that the encoding used when 
serializing pages corresponds to the encoding used when decoding request 
parameters.
  
@@ -47, +49 @@

  (Volkmar W. Pogatzki)''
  
  By default, if the browser doesn't explicitely mention the encoding, a 
servlet container will decode request parameters using the ISO-8859-1 encoding 
(independent of the platform on which the container is running). So in the 
above case where UTF-8 was used when serializing, we would be facing problems.
+ 
+ ''Note: Jetty uses 
[[http://docs.codehaus.org/display/JETTY/International+Characters+and+Character+Encodings
 UTF-8 as default for decoding form parameters]]! So you have to use the 
{{{SetCharacterEncodingFilter}}} (see below) to set the encoding for Jetty to 
ISO-8859-1 if this is what the browser sends.'' --AlexanderKlimetschek
  
  The encoding to use when decoding request parameters can be configured in the 
web.xml by supplying init parameters called "form-encoding" and 
"container-encoding" to the Cocoon servlet. The container-encoding parameter 
indicates according to what encoding the container tried to decode the request 
parameters (normally ISO-8859-1), and the form-encoding parameter indicates the 
actual encoding. Here's an example of how to specify the parameters in the 
web.xml: