Skip to content

StringHttpMessageConverter should assume charset UTF-8 for application/json [SPR-17568] #22100

@spring-projects-issues

Description

@spring-projects-issues

Thomas Meyer opened SPR-17568 and commented

When using "@RequestBody String jsonString" for an @Controller's @RequestMapping and the body is send as application/json with UTF-8 encoding, Spring uses StringHttpMessageConverter to convert the message, as the content-type will be application/json without any explicit encoding, so the StringHttpMessageConverter will fall back to the default encoding ISO-8859-1 which may is in accordance with the HTTP spec but not with RFC7159, which says: "The default encoding is UTF-8" (chapter 8.1)

 

So the suggestion would be to add an exception in the StringHttpMessageConverter to use UTF-8 charset for application/json.

 

 


Affects: 5.1.3

Referenced from: commits 05d6162

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions