ReviewOS

home-lang/home

Bun parity: decode UTF-16 BOMs in sliced Blob text and JSON

#343
Closed chris opened this 10 days ago ·
10 days ago

Upstream gap

Copied corpus position 4112 (js/web/fetch/blob.test.ts) reaches Bun’s odd-offset UTF-16 regression: Blob.slice(1).text() and .json() return empty subprocess output instead of decoding bytes beginning with an FF FE BOM.

Required parity

  • Detect UTF-16LE/BE BOMs from the selected Blob byte range, independent of its original backing-store alignment.
  • Use the same decoder for Blob text and JSON consumption.
  • Preserve UTF-8 BOM behavior and replacement semantics for malformed input.
  • Exercise the isolated subprocess path so aborts surface as child failures.
  • Add focused direct regression coverage and pass the complete upstream file and queue.

Tracked under #66; exposed after #339-#342.

10 days ago

Completed in add6ef2.\n\nBlob text/JSON decoding now detects UTF-16LE and UTF-16BE BOMs within the selected slice, handles odd trailing bytes with replacement semantics, and works across normal, typed, sparse, and file-slice backing. Child fixture failures use ERR_BLOB_CHILD_DECODE with operation/cause/composed stack metadata.\n\nVerified by the focused sliced UTF-16 BOM regression and js/web/fetch/blob.test.ts.

Sign in to comment on this issue.