Skip to content
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

PrintingResultHandler in MockMvc should infer UTF-8 encoding for JSON response #27926

Closed
sbrannen opened this issue Jan 12, 2022 · 0 comments
Closed
Assignees
Labels
in: test Issues in the test module in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@sbrannen
Copy link
Member

As explained in #27846 (comment), the PrintingResultHandler does not infer UTF-8 encoding for a response with content type application/json. Consequently, UTF-8 characters in such a response will be garbled in the output from the PrintingResultHandler.

Since PrintingResultHandler is effectively a client of the application (similar to the role a web browser plays), the PrintingResultHandler should infer the response encoding to be UTF-8 if the content type is application/json.

@sbrannen sbrannen added in: test Issues in the test module in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement labels Jan 12, 2022
@sbrannen sbrannen added this to the 5.3.15 milestone Jan 12, 2022
@sbrannen sbrannen self-assigned this Jan 12, 2022
@sbrannen sbrannen changed the title PrintingResultHandler in MockMvc does not infer UTF-8 encoding for JSON response PrintingResultHandler in MockMvc should infer UTF-8 encoding for JSON response Jan 12, 2022
snicoll added a commit that referenced this issue Jan 13, 2022
snicoll added a commit that referenced this issue Jan 13, 2022
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) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant