Return-Path: Delivered-To: apmail-cocoon-docs-archive@www.apache.org Received: (qmail 79109 invoked from network); 18 Jan 2007 17:38:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Jan 2007 17:38:11 -0000 Received: (qmail 22729 invoked by uid 500); 18 Jan 2007 17:38:17 -0000 Delivered-To: apmail-cocoon-docs-archive@cocoon.apache.org Received: (qmail 22592 invoked by uid 500); 18 Jan 2007 17:38:17 -0000 Mailing-List: contact docs-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: docs@cocoon.apache.org List-Id: Delivered-To: mailing list docs@cocoon.apache.org Received: (qmail 22580 invoked by uid 99); 18 Jan 2007 17:38:17 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Jan 2007 09:38:17 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS X-Spam-Check-By: apache.org Received: from [140.211.11.130] (HELO eos.apache.org) (140.211.11.130) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Jan 2007 09:38:10 -0800 Received: from eos.apache.osuosl.org (localhost [127.0.0.1]) by eos.apache.org (Postfix) with ESMTP id E2A6559F70 for ; Thu, 18 Jan 2007 17:37:49 +0000 (GMT) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Apache Wiki To: docs@cocoon.apache.org Date: Thu, 18 Jan 2007 17:37:49 -0000 Message-ID: <20070118173749.12516.91439@eos.apache.osuosl.org> Subject: [Cocoon Wiki] Update of "RequestParameterEncoding" by AlexanderKlimetschek X-Virus-Checked: Checked by ClamAV on apache.org 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: