struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 23255] - FormFile.getFileName() problem in multibyte character file name
Date Tue, 20 Jan 2004 08:56:10 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23255>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23255

FormFile.getFileName() problem in multibyte character file name





------- Additional Comments From takehiko.yokota@toshiba.co.jp  2004-01-20 08:56 -------
I tested EncodingFilter, but it didn't work well. Because web browsers send
"multipart/form-data" data encoding with the same encoding as
current web page.

We often set character encoding with HttpServletRequest#setCharacterEncoding()
so that Servlet containers can parse request parameter correctly,
but the setting isn't used when Struts parses "multipart/form-data" data
because CommonsMultipartRequestHandler never tell the request encoding to
a org.apache.commons.fileupload.DiskFileUpload instance.

The solution of thie problem is that 
ommonsMultipartRequestHandler#handleRequest() set the request encoding
to a DiskFileUpload instance. In other words, to make handleRequest()
call DiskFileUpload#setHeaderEncoding() with 
the value of HttpServletRequest#getCharacterEncoding() as the argument like:
------------------------------------------------------
DiskFileUpload upload = new DiskFileUpload();
upload.setHeaderEncoding(request.getCharacterEncoding());
------------------------------------------------------

I modified CommonsMultipartRequestHandler#handleRequest() like above
and tried to work well, and it worked just well with EncodingFilter.
(Note that thie approach requires that the request encoding is set
before Struts parses "multipart/form-data" request data. Thus
EncodingFilter is necessary.)

I attached the patch. Please check it.

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


Mime
View raw message