Parent: #140
Tracked by: #134
Profiles: #163, #164
Pinned consumers: Home 7ed99c02, Bun 4982b91e
Problem
Both declared private profiles require the same six TextCodec exports. This is Bun's fallback codec registry: native UTF-8, UTF-16, and Latin-1 are intentionally handled outside this boundary. The opaque codec must preserve exact label canonicalization, incremental state, BOM policy where applicable, error reporting, and owned BunString results.
Scope
- Implement
Bun__createTextCodec,Bun__deleteTextCodec, andBun__decodeWithTextCodecwith stable opaque ownership and streaming state. - Implement
Bun__stripBOMFromTextCodecwith the pinned codec-specific behavior. - Implement
Bun__isEncodingSupportedandBun__getCanonicalEncodingNamefrom one immutable, case-insensitive alias registry with stable canonical-name storage. - Match the pinned registry: x-user-defined; replacement aliases; Big5, EUC-JP, Shift_JIS, EUC-KR, ISO-2022-JP, GBK, gb18030; and the eleven pinned single-byte codecs. Preserve the deliberate absence of native UTF-8/UTF-16/Latin-1 and blocklisted UTF-7/BOCU-1/SCSU names.
- Preserve the pinned Home/Bun signatures and owned
BunStringreturn contract. - Regenerate both inventories and extend the compile-link-runtime fixture.
Acceptance
- Every pinned alias/canonical label is covered, including ASCII case folding, non-ASCII/empty/over-63-byte rejection, unsupported aliases, and process-lifetime canonical-name pointers.
- Representative and boundary vectors cover each canonical codec, incremental split sequences, flush, BOM handling, replacement, and stop-on-error state reset.
- Decode results are independently owned and release cleanly; null codec/output pointers and invalid non-empty data pointers fail safely.
- Home and Bun audits are green, the Home fixture executes all six signatures, and one descendant full CI matrix is accepted.