You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Apache Wiki <wi...@apache.org> on 2010/03/28 13:17:28 UTC

[Tomcat Wiki] Trivial Update of "FAQ/CharacterEncoding" by KonstantinKolinko

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Tomcat Wiki" for change 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=diff&rev1=10&rev2=11

--------------------------------------------------

   1. Set the `URIEncoding` attribute on the <Connector> element in server.xml to something specific (e.g. `URIEncoding="UTF-8"`).
   1. Set the `useBodyEncodingForURI` attribute on the <Connector> element in server.xml to `true`. This will cause the Connector to use the request body's encoding for GET parameters.
  
- References: [[http://tomcat.apache.org/tomcat-6.0-doc/config/http.html|Tomcat 6 HTTP Connector]], [[http://tomcat.apache.org/tomcat-6.0-doc/config/http.html|Tomcat 6 AJP Connector]]
+ References: [[http://tomcat.apache.org/tomcat-6.0-doc/config/http.html|Tomcat 6 HTTP Connector]], [[http://tomcat.apache.org/tomcat-6.0-doc/config/ajp.html|Tomcat 6 AJP Connector]]
  
  <<Anchor(Q3)>>'''How do I change how POST parameters are interpreted?'''
  
@@ -85, +85 @@

  
   1. Set URIEncoding="UTF-8" on your <Connector> 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="mime/type; charset=UTF-8" %>`)
+  1. Change all your JSPs to set the correct `Content-Type` (use `<%@page contentType="mime/type; charset=UTF-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 encoding to UTF-8.  For more information see http://www.mail-archive.com/users@tomcat.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" specification. 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 encoded in some way. Section 2.1 of the URI Syntax specification says that characters 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'' specified anywhere, which is why there is a lot of confusion when it comes to decoding 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" specification. 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 encoded in some way. Section 2.1 of the URI Syntax specification says that characters 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 = 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