Repository navigation
Conversation
Reuse the response parameter scanner through an experimental Util helper so quoted charset text cannot select the form request encoding. Keep caller header selection and UTF-8 fallback policies. Cover encoding, header ordering and the shared helper contract, and document form charset selection.
velo
approved these changes
Nov 10, 2026
velo
left a comment
Member
There was a problem hiding this comment.
Correct fix: FormEncoder now shares Response's quote-aware charset scanner, so charset text inside other parameters or longer parameter names no longer selects the encoding. Response behaviour is unchanged and the public API addition is @Experimental. Thanks!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FormEncoder can select a charset from text inside another quoted parameter. For example,
note="x;charset=ISO-8859-1"makesname=éencode asname=%E9, even though the request has no charset parameter. It should use the existing UTF-8 default and emitname=%C3%A9.Move the existing quote-aware Response scanner into the experimental
Util.charsetOfContentTypehelper and use it from both Response and FormEncoder. This also preventsxcharsetfrom selecting an encoding and makes form parameter whitespace handling consistent with Response. Response retains its header-order selection and UTF-8 fallback; FormEncoder still reads the first non-null Content-Type value. Malformed values follow the existing Response scanner rather than the old regex's partial matches.Follows up the shared-helper suggestions in #3611 and #3628. Includes five encoding/header regressions, two Response header-order controls, seven direct helper tests, and form charset documentation. No new dependencies or POM changes.
Validation with JDK 8 main compilation and JDK 25 tests, keeping the dev profile enabled:
mvn -Pdev -pl core,slf4j,form,form-spring -am clean install: 1,008 tests reported, 1,004 passed, four existing conditional skips, zero failures or errors; six projects succeeded. SLF4J is explicit because the form-spring test starter references it transitively.mvn -Pdev validate: 56 projects succeeded.AI-assisted implementation and code review; the validation above was executed locally.