You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2004/06/20 11:20:13 UTC

DO NOT REPLY [Bug 29668] - unicode text fields in "multipart/form-data" form are sent inncorrect

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=29668>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=29668

unicode text fields in "multipart/form-data" form are sent inncorrect





------- Additional Comments From florian.unger@t-systems.com  2004-06-20 09:20 -------
I have a solution to this:

Struts doesn't ignore character encoding, however it uses the request's
character encoding. This is done in
CommonsMultipartRequestHandler.addTextParameter():

[...]
try {
  value = item.getString(request.getCharacterEncoding());
} catch (Exception e) {
  value = item.getString();
}
[...]

Problem is the request seems not always to have an encoding set (at least in my
development environment).

Instructions: Subclass CommonsMultipartRequestHandler. Override
addTextParameter() to query whether the request has an encoding set and if not
set the encoding to whatever your forms use (for example "iso-8859-1" or
"utf-8"). Be aware however that the request parameter in this method is a
wrapper object that doesn't pass through setCharacterEncoding() to the real
HttpServlerRequest! After that let the method call super.addTextParameter().
Configure the controller in struts-config to use your subclass instead of the
default CommonsMultipartRequestHandler. This has been tested successfully. Ask
me if you need the code.

If your application uses forms with different character encodings an approach
could be used where a hidden form field (should then be the first) contains the
encoding used by the form and this encoding to be set the way described above.

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