J.Patterson Waltz III <lists 'at' cerenit.com> writes: > On 6 janv. 05, at 17:44, Guillaume Cottenceau wrote: > > > J.Patterson Waltz III <lists 'at' cerenit.com> writes: > > > >> Notice in the third line of the form data: > >> &personTO.comments=%C3%A9t%C3%A9 > >> That's 'été' URLencoded as UTF-8. > >> > >> So I'm still stumped. :-( > > > > But that's exactly what you want. The SetCharacterEncodingFilter > > will set the character encoding of the HttpServletRequest before > > data is retrieved from it, and when it's retrieved it should be > > correctly decoded. Are you sure the filter is up and running? > > > > I agree that that encoding is what I want. It's just that it's not > getting decoded upon display. Or rather, it's getting URL-decoded, but > not UTF-8 decoded.
Display is different from decoding. Double check the decoding first with log4j or anything. But beware that the JVM default charset and console charset may interfer so you might make use of my char decoder: byte[] b = querystring.getBytes( "UTF-8" ); String bytes = ""; for ( int i = 0; i < b.length; i++ ) { int val = b[i]; if ( val < 0 ) { val += 256; } bytes += Integer.toHexString( val ) + " "; } > I'm sure the filter is up and running because I added logging > statements to the Apache example code. So in my log, I see: > > 2005-01-06 17:30:34,706 DEBUG > [com.cerenit.sage.util.web.SetCharacterEncodingFilter] ignore = true, > encoding = utf-8, request encoding is null > 2005-01-06 17:30:34,706 DEBUG > [com.cerenit.sage.util.web.SetCharacterEncodingFilter] setting > encoding to utf-8 Yep. > I have the filter set to match the url-patterns *.do and *.jsp. > > I'm wondering if the fact that the form fields are all defined in > subtiles could make any difference: I'd guess not, since it's the > outermost tile which defines the page encoding. Your previous email seems to show that browser->tomcat is ok since you're really receiving URL encoded UTF8 strings, which is what you want. There is something with url decoding and/or decoding of byte content. > I also have another filter, the ResponseOverrideFilter used by > displaytag, which appears before the SetCharacterEncodingFilter in my > web.xml. I wonder if it could be interfering with the > SetCharacterEncodingFilter? Yes, if it reads the request parameters or request stream (by servlets specs). The SetCharacterEncodingFilter should be put first. I think this might be your problem. -- Guillaume Cottenceau --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]