Skip to content

fix: use explicit UTF-8 encoding in AuthParser URL decode/encode#12696

Open
ChihweiLHBird wants to merge 2 commits intoswagger-api:3.0.0from
ChihweiLHBird:urldecoder-update
Open

fix: use explicit UTF-8 encoding in AuthParser URL decode/encode#12696
ChihweiLHBird wants to merge 2 commits intoswagger-api:3.0.0from
ChihweiLHBird:urldecoder-update

Conversation

@ChihweiLHBird
Copy link

@ChihweiLHBird ChihweiLHBird commented Mar 24, 2026

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: 3.0.0 branch for changes related to OpenAPI spec 3.0. Default: master.

Description of the PR

  • Replace deprecated URLDecoder.decode(String) with URLDecoder.decode(String, String) using StandardCharsets.UTF_8 in AuthParser.parse()
  • Update URLEncoder.encode() in AuthParser.reconstruct() to use StandardCharsets.UTF_8.name() instead of a hardcoded "UTF-8" string literal
  • Remove 10-year-old FIXME comment (added in PR fix java warnings #1900, Jan 2016)

Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
Copilot AI review requested due to automatic review settings March 24, 2026 21:13
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates AuthParser to use explicit UTF-8 encoding for URL decode/encode operations, eliminating reliance on platform defaults and removing an outdated FIXME.

Changes:

  • Replace deprecated URLDecoder.decode(String) usage with URLDecoder.decode(String, String) using UTF-8.
  • Update URLEncoder.encode(..., "UTF-8") calls to use StandardCharsets.UTF_8.name().
  • Remove the old FIXME comment about deprecated decoding.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
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