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 [EMAIL PROTECTED]  2004-06-20 17:26 -------
This is a generic problem, not unique to Struts.  I believe this happens even
when GET method is used.  (Giorgi, does this happens only in POST?)

HTTP spec requires the client (browser) to add charset parameter in Content-Type
header if it is not ISO-8859-1.  But for some reasons I cannot understand, the
most browsers don't add charset parameter.  Struts, on the other hand,
faithfully follow the spec and it incorrectly interpret the form data as
ISO-8859-1 text stream.

In other words, struts is doing the *right* thing from the spec view point, but
it is not working right in the reality where the browsers are doing the wrong thing.

This problem is not limited to UTF-8 encoding.  Japanese developers suffer from
this everyday.  Ad-hoc solutions I have seen include:

A. Call request.setCharacterEncoding("Shift_JIS") within reset() method of
ActionForm subclasses.  (Most elegant, in my oppinion)

B. Reinterpret the parameter using this idiom:
   String fixed = new String(corrupted.getBytes("ISO_8859_1"), "Shift_JIS"In);

C. Subclass RquestProcessor that calls request.setCharacterEncoding()

All are too cumbersome.  

I think the struts should have another configuration parameter (call it
requestCharset for now), just like contentType parameter, in struts-config.xml.  
(Note: the character encoding of the response can be specified as part of
contentsType already.)  If requestCharset is specified, RequestProcessor should
call setCharacterEncoding on request.

I will file an enhancement request of that effect with a patch, if I don't hear
objection.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to