Skip to content

Requests with application/json Content-Type do not correctly assume UTF-8 charset #175

Closed
@eduramiba

Description

@eduramiba
  • Framework version: 1.1.1 - 1.1.3
  • Implementations: All

Scenario

It seems that the changes for #150 broke the assumption that all JSON is UTF-8, by definition.

Expected behavior

Parsing a JSON request body to a Java type should assume UTF-8 charset.

Actual behavior

It does not correctly handle characters out of ascii set.

Steps to reproduce

Send request with appplication/json in the Content-Type header and strange characters such as » in the JSON body. It will not be correctly parsed and throw a bad request.

If you set the Content-Type header to application/json; charset=UTF-8 then it works fine, but should not be necessary and most REST clients won't do it.

Full log output

Invalid UTF-8 middle byte 0x65\\n at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 13]\\n at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream);

Thanks for your support!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions