[Repo Assist] Change HTTP response default encoding from ISO-8859-1 to UTF-8#1665
Draft
github-actions[bot] wants to merge 5 commits intomainfrom
Draft
Conversation
Matches System.Net.Http.HttpClient behaviour. RFC 2616 specifies ISO-8859-1 as the default, but modern servers, browsers, and HttpClient all default to UTF-8 in practice. This fixes garbled characters when fetching UTF-8 content from servers that don't specify a charset. The responseEncodingOverride parameter can still be used to override for any response, including forcing ISO-8859-1 when needed. Closes #1251 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
3 tasks
Contributor
|
/repo-assist Please major bump the version to 9.0.0 as this could be considered a breaking change |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Author
|
Commit pushed:
|
Contributor
Author
|
🤖 Repo Assist here. Done! I've bumped the version from
|
…ault-utf8-ba30ad37ff9bf8f6
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.
🤖 This is an automated pull request from Repo Assist, an AI assistant for this repository.
Implements the fix requested in #1251 — changes the HTTP response default encoding from ISO-8859-1 to UTF-8 to match
System.Net.Http.HttpClientbehaviour.Closes #1251
Root Cause
HttpEncodings.ResponseDefaultEncodingwas set to ISO-8859-1, following RFC 2616 §3.7.1. However, modern HTTP servers, browsers, andSystem.Net.Http.HttpClientall default to UTF-8 in practice when nocharsetis specified in theContent-Typeresponse header. This caused garbled characters when fetching UTF-8 content from servers that don't include an explicit charset.@dsyme endorsed this fix in a comment: "Agreed we should do the same as HttpClient and do this."
Change
HttpEncodings.ResponseDefaultEncodingchanged fromEncoding.GetEncoding("ISO-8859-1")toEncoding.UTF8HttpEncodings.ResponseDefaultEncoding returns ISO-8859-1to reflect the new valueThe existing
responseEncodingOverrideparameter remains available for callers who need to force a specific encoding, including ISO-8859-1.Test Status
HttpEncodingstests: all 9 passTwo custom headers...— sandbox firewall blocks outbound HTTP, infrastructure issue unrelated to this change)Warning
The following domain was blocked by the firewall during workflow execution:
www.google.com