Skip to content

restore strict UTF-8 validation in text decoding#25

Merged
NicolasDP merged 1 commit into
primetype:masterfrom
dcSpark:restore-utf8-validation
Jul 8, 2026
Merged

restore strict UTF-8 validation in text decoding#25
NicolasDP merged 1 commit into
primetype:masterfrom
dcSpark:restore-utf8-validation

Conversation

@SebastienGllmt

@SebastienGllmt SebastienGllmt commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

ed40f20 changed the utf8 parsing from from strict String::from_utf8(bytes)? to from_utf8_lossy

RFC 8949 §3.1 requires major-type-3 payloads to be valid UTF-8, so this is a regression

This is a breaking change from 3.0.0 (return to v2 behavior)

This matches the behavior of other crates (serde_cbor, ciborium, cbor4ii) which all similarly error (like this PR)

Note: particularly important for cddl-codegen, as this regression broke round-trip serialization

Side-note: separately, Serializer::write_text_sz() now reports a chunk split falling inside a UTF-8 character as Error::InvalidTextError instead of the incorrect Error::InvalidLenPassed

@SebastienGllmt SebastienGllmt force-pushed the restore-utf8-validation branch from f46681f to 6ca445a Compare July 8, 2026 11:24
@NicolasDP NicolasDP merged commit 95e2be2 into primetype:master Jul 8, 2026
16 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.

2 participants