Return-Path: Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: (qmail 7654 invoked from network); 28 Mar 2010 11:17:55 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 28 Mar 2010 11:17:55 -0000 Received: (qmail 12834 invoked by uid 500); 28 Mar 2010 11:17:54 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 12592 invoked by uid 500); 28 Mar 2010 11:17:53 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 12576 invoked by uid 99); 28 Mar 2010 11:17:53 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 28 Mar 2010 11:17:53 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED 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; Sun, 28 Mar 2010 11:17:50 +0000 Received: from eos.apache.org (localhost [127.0.0.1]) by eos.apache.org (Postfix) with ESMTP id D4EFF17DB2 for ; Sun, 28 Mar 2010 11:17:28 +0000 (GMT) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Apache Wiki To: Apache Wiki Date: Sun, 28 Mar 2010 11:17:28 -0000 Message-ID: <20100328111728.25287.87375@eos.apache.org> Subject: =?utf-8?q?=5BTomcat_Wiki=5D_Trivial_Update_of_=22FAQ/CharacterEncoding=22?= =?utf-8?q?_by_KonstantinKolinko?= X-Virus-Checked: Checked by ClamAV on apache.org Dear Wiki user, You have subscribed to a wiki page or wiki category on "Tomcat Wiki" for ch= ange notification. The "FAQ/CharacterEncoding" page has been changed by KonstantinKolinko. The comment on this change is: Corrected some misprints. http://wiki.apache.org/tomcat/FAQ/CharacterEncoding?action=3Ddiff&rev1=3D10= &rev2=3D11 -------------------------------------------------- 1. Set the `URIEncoding` attribute on the element in server.= xml to something specific (e.g. `URIEncoding=3D"UTF-8"`). 1. Set the `useBodyEncodingForURI` attribute on the element = in server.xml to `true`. This will cause the Connector to use the request b= ody's encoding for GET parameters. = - References: [[http://tomcat.apache.org/tomcat-6.0-doc/config/http.html|To= mcat 6 HTTP Connector]], [[http://tomcat.apache.org/tomcat-6.0-doc/config/h= ttp.html|Tomcat 6 AJP Connector]] + References: [[http://tomcat.apache.org/tomcat-6.0-doc/config/http.html|To= mcat 6 HTTP Connector]], [[http://tomcat.apache.org/tomcat-6.0-doc/config/a= jp.html|Tomcat 6 AJP Connector]] = <>'''How do I change how POST parameters are interpreted?''' = @@ -85, +85 @@ = 1. Set URIEncoding=3D"UTF-8" on your in server.xml 1. Use a [[#Q3|character encoding filter]] with the default encoding set= to UTF-8 - 1. Change all your JSPs to set the correct `Content-Type` (use `<%@page = cotnentType=3D"mime/type; charset=3DUTF-8" %>`) + 1. Change all your JSPs to set the correct `Content-Type` (use `<%@page = contentType=3D"mime/type; charset=3DUTF-8" %>`) 1. Change all your servlets to set the content type for responses to UTF= -8 1. Change any content-generation libraries you use (Velocity, Freemarker= , etc.) to use UTF-8 as the content type 1. Disable any valves or filters that may read request parameters before= your character encoding filter or jsp page has a chance to set the encodin= g to UTF-8. For more information see http://www.mail-archive.com/users@tom= cat.apache.org/msg21117.html. @@ -107, +107 @@ = ''Default encoding for GET'' = - The character set for HTTP query strings (that's the technical term for '= GET parameters') can be found in sections 2 and 2.1 the "URI Syntax" specif= ication. The character set is defined to be [[http://en.wikipedia.org/wiki/= ASCII|US-ASCII]]. Any character that does not map to US-ASCII must be encod= ed in some way. Section 2.1 of the URI Syntax specification says that chara= cters outside of US-ASCII must be encoded using `%` escape sequences: each = character is encoded as a literal `%` followed by the two hexadecimal codes= which indicate its character code. Thus, `a` (US-ASCII character code 0x97= ) is equivalent to `%97`. There ''is no default encoding for URIs'' specifi= ed anywhere, which is why there is a lot of confusion when it comes to deco= ding these values. + The character set for HTTP query strings (that's the technical term for '= GET parameters') can be found in sections 2 and 2.1 the "URI Syntax" specif= ication. The character set is defined to be [[http://en.wikipedia.org/wiki/= ASCII|US-ASCII]]. Any character that does not map to US-ASCII must be encod= ed in some way. Section 2.1 of the URI Syntax specification says that chara= cters outside of US-ASCII must be encoded using `%` escape sequences: each = character is encoded as a literal `%` followed by the two hexadecimal codes= which indicate its character code. Thus, `a` (US-ASCII character code 97 = =3D 0x61) is equivalent to `%61`. There ''is no default encoding for URIs''= specified anywhere, which is why there is a lot of confusion when it comes= to decoding these values. = Some notes about the character encoding of URIs: 1. ISO-8859-1 and ASCII are compatible for character codes 0x20 to 0x7E,= so they are often used interchangeably. Most of the web uses ISO-8859-1 as= the default for query strings. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org