Skip to content

honour response charset in gson and jackson iterator decoders - #3447

Merged
velo merged 1 commit into
OpenFeign:masterfrom
alhudz:decoder-response-charset
Jul 28, 2026
Merged

honour response charset in gson and jackson iterator decoders#3447
velo merged 1 commit into
OpenFeign:masterfrom
alhudz:decoder-response-charset

Conversation

@alhudz

@alhudz alhudz commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Repro: a server response with Content-Type: application/json; charset=ISO-8859-1 and an ISO-8859-1 encoded body decoded through GsonDecoder, JacksonIteratorDecoder or Jackson3IteratorDecoder.
Cause: those three read the body with asReader(UTF_8), dropping response.charset(), so non-ASCII bytes come back as U+FFFD. The sibling JacksonDecoder, Jackson3Decoder, Fastjson2Decoder, JacksonJrDecoder and JsonDecoder already pass response.charset().
Fix: pass response.charset() in the three decoders, matching the siblings. response.charset() already defaults to UTF-8, so plain UTF-8 responses are unchanged. Regression test added per module.

GsonDecoder, JacksonIteratorDecoder and Jackson3IteratorDecoder read the response body with asReader(UTF_8), ignoring response.charset(). A non-UTF-8 charset declared on the response (e.g. charset=ISO-8859-1) is mis-decoded to U+FFFD. The sibling JSON decoders all pass response.charset(); do the same here.

Signed-off-by: Alhuda Khan <al.hudz.k@gmail.com>
@alhudz

alhudz commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

gentle ping

@velo velo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved via agent-assisted review: change includes tests, no backwards-compatibility break, no security concerns, CI green.

@velo
velo merged commit 564d41e into OpenFeign:master Jul 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants