Skip to content

FormHttpMessageConverter writes ASCII encoded so that a multipart form data can not contain filenames with German Umlaute [SPR-12108] #16724

@spring-projects-issues

Description

@spring-projects-issues

Leif Hanack opened SPR-12108 and commented

Hi there,

we encountered a problem using FormHttpMessageConverter when writing a multi part. Our use case is to create a multi part on the server side and send it to another service. The multi part contains a FileSystemResource and has a filename with German Umlaute (e.g. "Hallöle.png").

Unfortunately FormHttpMessageConverter.write uses getAsciiBytes. This seems to be W3C compliant.

Control names originally encoded in non-ASCII character sets may be encoded using the method outlined in [RFC2045]. (http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1)

We tried a couple of things even javax.mail.internet.MimeUtility.decode, but nothing worked for us.

We were only able to get it fixed when changing
name.getBytes("US-ASCII")
to
name.getBytes("UTF-8")

What would you recommend? How to deal with NON-ASCII characters?

Thanks a lot, Leif


Affects: 4.0.6

Issue Links:

Referenced from: commits 7f43f02, 9be0cf2

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions