Skip to content

honour response charset in StringDecoder#3453

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

honour response charset in StringDecoder#3453
alhudz wants to merge 1 commit into
OpenFeign:masterfrom
alhudz:string-decoder-charset

Conversation

@alhudz

@alhudz alhudz commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Repro: a String-returning method against a server that replies Content-Type: text/plain; charset=ISO-8859-1 with body byte 0xE9.
Expected: é.
Actual: U+FFFD, because the byte is run through a UTF-8 reader.
Cause: StringDecoder.decode reads the body with asReader(Util.UTF_8), so the charset response.charset() already resolves from Content-Type is dropped. DefaultDecoder extends it, so this is the default behaviour for every non-UTF-8 String response.
Fix: decode with response.charset(), which already falls back to UTF-8 when none is declared, matching the JSON decoders (jackson, json, fastjson2, jackson-jr).

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.

1 participant