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.


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...

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

Reply via email to