tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Funk <funk...@joedog.org>
Subject [Bug 23929] - request.setCharacterEncoding(String) doesn't work
Date Wed, 14 Jan 2004 13:29:36 GMT
Since this seems a rather populate bug topic ... I'd like to add this to the 
FAQ. Besides linking to this bug report, can anyone provide me:
1) A suggested wording for how to phrase this as a question
2) A suggested wording for the answer (I can figure this out)
3) Any other links (to the archives, or other bug reports) that might help 
any users looking at this.

-Tim

bugzilla@apache.org wrote:
> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23929
> 
> request.setCharacterEncoding(String) doesn't work
> 
> ------- Additional Comments From remm@apache.org  2004-01-14 13:03 -------
>>>From Mark:
> 
> Character encoding has been the source of quite a bit of debate on the tomcat-
> dev list in recent weeks. There have been a few changes (see summary below) as 
> a result. Essentially some additional configuration options have been 
> provided. The UTF-8 issue (also reported in bug 22666) has also been fixed.
> 
> Character encoding summary
> ==========================
> 
> There are a number of situations where there may be a requirement to use non-
> US ASCII characters in a URI. These include:
> - Parameters in the query string
> - Servlet paths
> 
> There is a standard for encoding URIs (http://www.w3.org/International/O-URL-
> code.html) but this standard is not consistently followed by clients. This 
> causes a number of problems.
> 
> The functionality provided by Tomcat (4 and 5) to handle this less than ideal 
> situation is described below.
> 
> 1. The Coyote HTTP/1.1 connector has a useBodyEncodingForURI attribute which 
> if set to true will use the request body encoding to decode the URI query 
> parameters.
>   - The default value is true for TC4 (breaks spec but gives consistent 
> behaviour across TC4 versions)
>   - The default value is false for TC5 (spec compliant but there may be 
> migration issues for some apps)
> 2. The Coyote HTTP/1.1 connector has a URIEncoding attribute which defaults to 
> ISO-8859-1.
> 3. The parameters class (o.a.t.u.http.Parameters) has a QueryStringEncoding 
> field which defaults to the URIEncoding. It must be set before the parameters 
> are parsed to have an effect.
> 
> Things to note regarding the servlet API:
> 1. HttpServletRequest.setCharacterEncoding() normally only applies to the 
> request body NOT the URI.
> 2. HttpServletRequest.getPathInfo() is decoded by the web container.
> 3. HttpServletRequest.getRequestURI() is not decoded by container.
> 
> Other tips:
> 1. Use POST with forms to return parameters as the parameters are then part of 
> the request body.
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message