Reads response charset after other Content-Type parameters by hutiefang76 · Pull Request #3628 · OpenFeign/feign · GitHub
Skip to content

Reads response charset after other Content-Type parameters - #3628

Open
hutiefang76 wants to merge 1 commit into
OpenFeign:masterfrom
hutiefang76:frank/thirty-feign-response-charset-20261019
Open

hutiefang76 wants to merge 1 commit into
OpenFeign:masterfrom
hutiefang76:frank/thirty-feign-response-charset-20261019

Conversation

@hutiefang76

Copy link
Copy Markdown
Contributor

Content-Type: text/plain; format=flowed; charset=ISO-8859-1 currently falls back to UTF-8 because Response.charset() only reads the first parameter. Latin-1 bytes for café consequently decode as caf�.

Scan parameter boundaries outside quoted strings and recognize charset at any position. The scanner handles escaped quotes and ignores fake charset text inside another parameter's quoted value. Missing or unsupported charsets retain the UTF-8 fallback. Includes actual decoder regressions and a changelog entry; no dependency or public API change.

Fixes #3626. Separate from outgoing FormEncoder handling in #3611 and streaming in #3551.

Validation: baseline ResponseTest/DefaultDecoderTest reported seven failures among 26 tests. The fixed core passes 783 tests, zero failures/errors, four existing conditional skips with mvn -B -Pdev --toolchains <local-toolchains> -pl core clean install. Root dev validate passes (repeated after a test-comment correction). Main sources compile with JDK 8; tests use actual Temurin 25.0.4.1. The skips are the existing parameter-name test and three restricted-header property tests. Independently reviewed full diff.

Implemented, tested, independently reviewed and posted with AI assistance for @hutiefang76.

Scan parameter boundaries outside quoted strings to recognize charset at
any position without treating quoted parameter data as a charset. Preserve
UTF-8 fallback for missing or unsupported charsets and add decoder tests.

Fixes OpenFeign#3626
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.

Response.charset ignores charset after another Content-Type parameter

1 participant