[
https://issues.apache.org/jira/browse/FILEUPLOAD-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17738457#comment-17738457
]
Vladimir Sitnikov commented on FILEUPLOAD-206:
----------------------------------------------
+1.
The fix would be to use UTF-8 in
https://github.com/apache/commons-fileupload/blob/c4f32a13298f6b9561c136b61b23c9e2c6d82368/src/main/java/org/apache/commons/fileupload/MultipartStream.java#L592
> Encoding of parts incorrectly determined and assumed to be
> ----------------------------------------------------------
>
> Key: FILEUPLOAD-206
> URL: https://issues.apache.org/jira/browse/FILEUPLOAD-206
> Project: Commons FileUpload
> Issue Type: Bug
> Affects Versions: 1.2.2
> Reporter: Holger Sunke
> Priority: Major
>
> When submitting user input form fields with a form having
> enctype="multipart/form-data", FileUpload assumes "ISO-8...-1" to be the
> default encoding for each part, not taking into account that
> request.getContentEncoding() returns "UTF-8".
> The description of FILEUPLOAD-101 states: "Each individual part in the
> 'multipart/form-data' encoded requests may have its own content type
> definition."
> In my opinion, this assumption is wrong, as the the multipart/form-data
> encoding algorithm tells the right opposite regarding non file form fields:
> "... The parts of the generated multipart/form-data resource that correspond
> to non-file fields must not have a Content-Type header specified. Their names
> and values must be encoded using the character encoding selected above (field
> names in particular do not get converted to a 7-bit safe encoding as
> suggested in RFC 2388)..."
> See:
> http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#multipart-form-data
> So for now as user of FileUpload, i don't see a way to tell FileUpload that
> my FormFields are UTF-8 encoded, resulting in corrupted user input.
> Even request.setContentEncoding("UTF-8"); does not help, neither <form ...
> accept-charset="UTF-8" ...> does.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)