Skip to content

UriModifyingContentModifier.modifyContent decodes with the request charset but re-encodes with the platform default#1041

Open
config25 wants to merge 1 commit intospring-projects:3.0.xfrom
config25:fix/uri-modifier-charset-encoding
Open

UriModifyingContentModifier.modifyContent decodes with the request charset but re-encodes with the platform default#1041
config25 wants to merge 1 commit intospring-projects:3.0.xfrom
config25:fix/uri-modifier-charset-encoding

Conversation

@config25
Copy link
Copy Markdown
Contributor

UriModifyingContentModifier.modifyContent() decodes the request/response
body using the charset from the Content-Type header, but re-encodes with
String.getBytes() (no charset argument), which falls back to the JVM
default. When these differ, non-ASCII characters get corrupted.

Use the same charset for both decoding and encoding, falling back to
Charset.defaultCharset() when no charset is declared.

Fixes gh-1039

Copy link
Copy Markdown
Member

@wilkinsona wilkinsona left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please run ./gradlew format and update the proposal with the resulting changes.

@wilkinsona wilkinsona changed the title Use consistent charset for encoding and decoding in UriModifyingContentModifier UriModifyingContentModifier.modifyContent decodes with the request charset but re-encodes with the platform default Apr 13, 2026
@wilkinsona wilkinsona added type: bug A bug and removed status: waiting-for-triage Untriaged issue labels Apr 13, 2026
@wilkinsona wilkinsona added this to the 3.0.x milestone Apr 13, 2026
…ntModifier

Fixes spring-projectsgh-1039

Signed-off-by: config25 <yhkim052556@naver.com>
@config25 config25 force-pushed the fix/uri-modifier-charset-encoding branch from a8bf53f to e7f0e1c Compare April 13, 2026 07:20
@config25
Copy link
Copy Markdown
Contributor Author

Sorry about that. I've run ./gradlew format and updated the commit with the formatted changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants