Skip to content

ContentRequestMatchers.MultipartHelper default charset #31923

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

Closed
azdanov opened this issue Dec 29, 2023 · 1 comment
Closed

ContentRequestMatchers.MultipartHelper default charset #31923

azdanov opened this issue Dec 29, 2023 · 1 comment
Labels
in: test Issues in the test module in: web Issues in web modules (web, webmvc, webflux, websocket) status: superseded An issue that has been superseded by another

Comments

@azdanov
Copy link
Contributor

azdanov commented Dec 29, 2023

Affects: 6.1.2


While using the @RestClientTest I had an issue where I sent a Multipart request and wanted to confirm in a test that it was correctly formed.

But during testing I noticed that the request was handled by MultipartHelper and it didn't parse correctly my application/json part in UTF-8, resulting in some symbols being malformed. Although, it worked correctly while using the deprecated application/json; charset=utf-8.

After further investigation I noticed that DiskFileItemFactory is used with default values, with the charset set to this.defaultCharset = "ISO-8859-1".

Would it make sense for MultipartHelper to default to UTF-8?

FileUpload fileUpload = new FileUpload();
DiskFileItemFactory factory = new DiskFileItemFactory();
factory.setDefaultCharset(StandardCharsets.UTF_8.name());
fileUpload.setFileItemFactory(factory);
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Dec 29, 2023
@sbrannen sbrannen added in: test Issues in the test module in: web Issues in web modules (web, webmvc, webflux, websocket) labels Dec 30, 2023
@sbrannen
Copy link
Member

Please refrain from opening both an issue and a PR for the same topic.

@sbrannen sbrannen closed this as not planned Won't fix, can't repro, duplicate, stale Dec 30, 2023
@sbrannen sbrannen added status: superseded An issue that has been superseded by another and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Dec 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: test Issues in the test module in: web Issues in web modules (web, webmvc, webflux, websocket) status: superseded An issue that has been superseded by another
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants