Skip to content

honour response charset in StringDecoder - #3453

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

honour response charset in StringDecoder#3453
velo merged 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).

@alhudz

alhudz commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

any update?

@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 25e4fab 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