Skip to content

[Repo Assist] fix: change HTTP response default encoding from ISO-8859-1 to UTF-8 (Closes #1251)#1754

Draft
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/fix-issue-1251-http-utf8-2026-04-21-ff59141c97ad948e
Draft

[Repo Assist] fix: change HTTP response default encoding from ISO-8859-1 to UTF-8 (Closes #1251)#1754
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/fix-issue-1251-http-utf8-2026-04-21-ff59141c97ad948e

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 This is an automated pull request from Repo Assist, an AI assistant for this repository.

Closes #1251
Supersedes #1717 (that PR's branch accumulated merge commits from main including protected workflow files, making pushes to it fail; this is a clean rebase onto current main).

Root Cause

HttpEncodings.ResponseDefaultEncoding was set to ISO-8859-1, following RFC 2616 §3.7.1. However, modern HTTP servers, browsers, and System.Net.Http.HttpClient all default to UTF-8 in practice when no charset is specified in the Content-Type response header. This caused garbled characters when fetching UTF-8 content from servers that don't include an explicit charset.

@dsyme endorsed this fix: "Agreed we should do the same as HttpClient and do this."

Changes

  • src/FSharp.Data.Http/Http.fsResponseDefaultEncoding changed from Encoding.GetEncoding("ISO-8859-1") to Encoding.UTF8; doc comment updated
  • src/FSharp.Data.DesignTime/{Csv,Json,Xml,Html}Provider.fsEncoding XML doc param updated to reflect new default
  • tests/FSharp.Data.Core.Tests/HttpEncodings.fs — updated test to expect utf-8
  • RELEASE_NOTES.md — version bump to 8.1.11

The existing responseEncodingOverride parameter remains available for callers who need to force ISO-8859-1.

Test Status

  • dotnet test tests/FSharp.Data.Core.Tests/ --filter HttpEncodings9 passed (including the updated ResponseDefaultEncoding returns UTF-8 test)
  • dotnet run --project build/build.fsproj -t RunTests2957 core tests + 489 design-time tests, 0 failed

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@96b9d4c39aa22359c0b38265927eadb31dcf4e2a

…loses #1251)

ResponseDefaultEncoding now defaults to UTF-8, matching System.Net.Http.HttpClient
behaviour. RFC 2616 specified ISO-8859-1 but modern servers and browsers default to
UTF-8; the old default caused garbled output when fetching UTF-8 content without an
explicit charset in the Content-Type response header.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problem with Http.RequestString detection of response content encoding

0 participants