Repository navigation
fix: decode problem details responses as strict UTF-8 - #26
Merged
Merged
Conversation
Parse inputs take body or body_hex, and four byte cases pin strict UTF-8 with one optional byte-order mark. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YPqZepyt7atNAZ12qoUeVS
A Response body that is not valid UTF-8 now gives the unexposed fallback instead of a problem with replacement characters. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YPqZepyt7atNAZ12qoUeVS
KyleJune
marked this pull request as ready for review
December 5, 2026 16:42
github-actions Bot
pushed a commit
that referenced
this pull request
Dec 5, 2026
## [0.13.1](0.13.0...0.13.1) (2026-12-05) ### Bug Fixes * decode problem details responses as strict UTF-8 ([#26](#26)) ([68519bc](68519bc))
|
🎉 This PR is included in version 0.13.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Requested by Kyle · project thread
Summary
Defines the byte encoding of a Problem Details response: the body is decoded as strict UTF-8, allowing one leading UTF-8 byte-order mark. A body that is not valid UTF-8 (Latin-1, UTF-16, ...) now gets the same unexposed fallback as an unparsable JSON body.
HttpError.from(response)decoded withresponse.json(), which replaces invalid bytes. A Latin-1 body such as{"title":"Caf\xe9","status":422}became an exposed 422 titledCaf�. It now decodes with a fatalTextDecoderand returns the unexposed fallback with the response's status.body(text) orbody_hex(exact bytes). Four byte cases added:utf8,utf8-bom,utf16le-bom,latin1-in-title. Both runners build the response from those bytes before calling the public parser.Constructors that take decoded values are unchanged.
Release note
A non-UTF-8 problem details response body now yields the unexposed fallback error instead of a problem with replacement characters.
Testing
pnpm check,vitest run(124 passed). Thelatin1-in-titlevector fails without themod.tschange.-D warnings,cargo test --workspace --all-features.Generated by Claude Code