Skip to content

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

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

UriModifyingContentModifier.modifyContent decodes with the request charset but re-encodes with the platform default#1041
config25 wants to merge 0 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
@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.

@wilkinsona wilkinsona closed this May 6, 2026
@wilkinsona wilkinsona force-pushed the fix/uri-modifier-charset-encoding branch from e7f0e1c to 4a55491 Compare May 6, 2026 12:35
@wilkinsona wilkinsona removed this from the 3.0.x milestone May 6, 2026
@wilkinsona
Copy link
Copy Markdown
Member

Re-opening as I botched up the processing.

@wilkinsona wilkinsona added this to the 3.0.x milestone May 6, 2026
@wilkinsona
Copy link
Copy Markdown
Member

@config25 Sorry, I botched up the processing of this PR and it looks like GitHub won't let me re-open it. Can you please re-open it so that I can tidy things up?

@wilkinsona wilkinsona removed this from the 3.0.x milestone May 6, 2026
@config25
Copy link
Copy Markdown
Contributor Author

config25 commented May 7, 2026

@wilkinsona Reopened the work as #1043 since GitHub wouldn't let me reopen this one. Same branch, same commit (e7f0e1c) — should be ready for you to tidy up.

@wilkinsona
Copy link
Copy Markdown
Member

Thanks very much.

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