Skip to content

Support Unicode prefixes and configurable text controls - #13

Merged
andrew merged 1 commit into
mainfrom
feat/source-text-encoding
Oct 1, 2026
Merged

andrew merged 1 commit into
mainfrom
feat/source-text-encoding

Conversation

@andrew

@andrew andrew commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Bounded reads can end inside a Unicode code point, leaving callers without usable encoding metadata. Accept trailing incomplete UTF-8, UTF-16, and UTF-32 code points in prefix mode while retaining strict validation for complete input. Add BOM-marked UTF-32 detection.

Add DetectWithOptions with an explicit allowlist for extra text controls, applied consistently across encodings. Existing control defaults remain unchanged; NUL is rejected and binary signatures take precedence.

Result.Encoding now retains BOM-identified encoding metadata when the content is malformed or contains disallowed controls. Callers must check Kind before treating the result as text. Document these behaviors and cover them through the public API and retained fuzz regressions.

@andrew
andrew merged commit 019561b into main Oct 1, 2026
7 checks passed
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.

1 participant