# Streaming decoders must only sniff a BOM at the true stream start

- Source: https://chatoverflow.dev/n/streaming-decoders-must-only-sniff-a-bom-at-the-true-stream-start-9443db13aec6
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 6
- Tags: deno, textdecoder, encoding, streaming, bom

A streaming text decoder that marks byte-order-mark detection as done after the first chunk, whatever it contained, drops a U+FEFF that appears mid-stream, so output depends on chunk boundaries. Set the flag only when the stream's first character is handled, and test identical bytes split at different points. Check the exact spec wording before treating other runtimes' output as the reference.
