-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Erik,
On 7/30/2010 12:19 PM, Erik Bunn wrote: > Christopher Schultz, Wed, 21 Apr 2010 08:43:57 -0700 wrote: >> The filter cannot influence the way that GET parameters are decoded. The >> only way to change that is to set URIEncoding="UTF-8" on your >> <Connector> in >> server.xml. > > This is, at least in some special cases, incorrect: based on quite a bit > of Tomcat 7.0b embedding effort recently, I tracked this same issue all > the way through, and Tomcat defaults to ISO-8859-1 if the request does > not specify content-type explicitly, despite whatever Connector settings. > See e.g. CoyoteAdapter.parsePathParameters() for an example. > > (A request without content-type happens e.g. in Firefox 3.6 with a > dynamically created script DOM element to an external URL; I'm sure > there are other occasions as well.) This has nothing to do with the Content-Type HTTP header, which governs the character encoding of the request body. Instead, it has to do with the character encoding of the request /URI/, for which there is no widespread standard for explicitly indicating in the request. Tomcat versions before 7.x had an option in the <Connector> which could be used to set the request URI encoding to that of the Content-Type of the request (useBodyEncodingForURI) and another option for explicitly and unconditionally setting the encoding to be used for URI decoding (URIEncoding). I haven't read-up on Tomcat 7 behavior. > The only way I found around it was to have my own Connector > implementation provide my own Request wrapper, and override > getCharacterEncoding() there based on the URIEncoding setting. > (Not very user-friendly; I imagine it's doable with the standard > configuration scheme, but I can't help with that - sorry. Feel > free to email if you need pointers, anyway.) Again, the getCharacterEncoding method on the request dictates the encoding used to decode the request body, not the request URI. If all you want to do is set the character encoding, you can easily call setCharacterEncoding and be done with it: subclassing and overriding should not be necessary at all, otherwise nobody would have written one of these: http://www.google.com/search?q=characterencodingfilter - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkxS/twACgkQ9CaO5/Lv0PAh7QCeN4B/N7+iq/TcEv+QewcLV/5O Hb0AniwHt0EDHqlKl67v7nD6VoqoU+X3 =W9t4 -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org