-
Notifications
You must be signed in to change notification settings - Fork 38.5k
FormHttpMessageConverter should use configured charset (by default UTF-8) for "text-plain" MIME part conversion as well [SPR-14338] #18910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Juergen Hoeller commented Brian Clozel, Rossen Stoyanchev, since we're not likely to change the default encoding there, what about making a custom encoding more easily configurable? We could still aim for that for 4.3 GA. |
Rossen Stoyanchev commented Note that on the server-side the MVC Java config has a convenient method to extend the list of message converters without completely replacing the default ones, see |
Rafał Garbowski commented The case is client-side config e.g. Maybe there is possibility to make
|
Juergen Hoeller commented There are a few charset configuration options on |
Juergen Hoeller commented As far as I can see, this is actually inconsistent at the moment: So as of 4.3 GA, we're applying a |
Juergen Hoeller commented Rafał Garbowski, since this is available in the latest |
Rafał Garbowski commented Unfortunately I cannot make any integration test, because of versions conflict. However I ran unit test from my original solution and it passed, so good job :) |
Rafał Garbowski opened SPR-14338 and commented
Problem:
By default "FormHttpMessageConverter" encodes "text/plain" parts of "MULTIPART_FORM_DATA" message in "latin-1" charset, so eastern european characters are not supported.
Here is example, where I want to send value "łęąć".
How it works now:
And how it should work:
Now workaround is defining all default converters once again in some configuration bean, setting UTF-8 to "StringHttpMessageConverter" and then putting back as argument of method "setPartConverters".
Why not use UTF-8 by default to encode "plain/text" MIME parts? Here is link to "pull-request" of this solution on GitHub:
3cdda3a
In multipart/form-data specs I didn't find a word about preferable encoding.
In our case "FormHttpMessageConverter" is forcing "ISO-8859-1" charset. It isn't the same as not defining it at all and allowing recipient to use default - see this answer on stackoverflow. So FIX presented on Github shouldn't crash old systems. Is there any application that accepts only "latin-1" encoded requests? I don't think so.
Reference URL: #1072
Issue Links:
The text was updated successfully, but these errors were encountered: