Skip to content

honour response charset in gson and jackson iterator decoders#3447

Open
alhudz wants to merge 1 commit into
OpenFeign:masterfrom
alhudz:decoder-response-charset
Open

honour response charset in gson and jackson iterator decoders#3447
alhudz wants to merge 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant