On Sun, 29 Aug 2004 20:22:57 -0500, Joe Germuska <[EMAIL PROTECTED]> wrote: > At 3:32 AM +0100 8/29/04, Niall Pemberton wrote: > >Joe, > > > >Thought the following bugs might be useful input to you... > > > >There is an alternative solution suggested in Bug 23255 - which was to use a > >filter to set the character encoding if it has not been set by the browser: > >http://issues.apache.org/bugzilla/show_bug.cgi?id=23255 > > That works as a solution for people using Servlet 2.4. I have > production environments that aren't there yet, so I'm motivated to > find a solution within Struts. > > > >In bugs 29824/29668 they discuss request encoding in general, not just for > >multipart requests, so maybe a wider solution is required: > >http://issues.apache.org/bugzilla/show_bug.cgi?id=29824 > >http://issues.apache.org/bugzilla/show_bug.cgi?id=29668 > > 29668 is basically a statement of the problem I am facing. I guess I > should have looked through bugzilla. It looks as though 29824 > proposes using setCharacterEncoding, so I don't think it would > compile with Servlet 2.2. (I haven't tried it yet.) > > > >Also, does the new "acceptCharset" attribute on <html:form> help at all with > >this problem? > > No; request.getCharacterEncoding still returns null, which means that > Struts still uses a hard-coded default value. I was noticing that in > the nightlies of commons-fileupload, the library attempts to retrieve > the charset from the 'part' (of the multipart/form-data) but that > doesn't seem to be getting set either. I haven't gotten down to the > level of looking at what the browser sends over the wire, but I > plugged that in and fiddled with some logging in > CommonsMultipartRequestHandler and it didn't look as though the value > was being sent.
The browsers do not send the character encoding either on the overall request or on the individual parts. The code in Commons FileUpload that checks the encoding in the individual parts was added by Oleg K, of the Commons HttpClient team, so that it would work with requests being constructed and sent by HttpClient. > Would it be a bad idea to use reflection to test the request to see > if it accepts a setCharacterEncoding property? It seems like this > might provide a solution which works completely for Servlet 2.4 and > could still give CommonsMultipartRequestHandler a place to look up a > configured encoding for earlier versions of the Servlet API. I'm not > sure if that's what Martin is suggesting, or if he's just suggesting > that we set out this way with the expectation that we'll eventually > be able to use the same property for both kinds of form submissions... I'm not so thrilled about using reflection; I was meaning more of the latter. We can create a more general property now, and use it for only multipart requests, with the expectation that we'll be able to apply it more generally later. What I didn't want to do is create a multipart-only property now, which would need to be replaced by a more general one once we can depend on Servlets 2.4. -- Martin Cooper > > Joe > > > > -- > Joe Germuska > [EMAIL PROTECTED] > http://blog.germuska.com > "In fact, when I die, if I don't hear 'A Love Supreme,' I'll turn > back; I'll know I'm in the wrong place." > - Carlos Santana --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
