Commit Graph
1 Commits
Author SHA1 Message Date
Joeseph GreyandGitHub 9246871b8b fix: skip UTF-8 BOM when processing front matter (#2751)
* fix: skip UTF-8 BOM when processing front matter

--front-matter=process wrapped the file in a bufio.Reader without
skipping a leading UTF-8 BOM, so a BOM before the opening --- meant the
separator was not recognised and the opening --- was dropped from the
output (data loss). Skip the BOM with utfbom.Skip before wrapping the
reader, matching the CSV object decoder.

* refactor: inline UTF-8 BOM skip instead of utfbom dependency

per ccoVeille's review, front matter only needs UTF-8 BOM handling, not
the full utfbom package. replace utfbom.Skip with a small unexported
stripUTF8BOM helper and add a stdin-path regression test alongside the
existing file-path one. utfbom stays in go.mod since decoder_csv_object.go
still uses it for CSV decoding.
2026-08-03 11:29:33 +10:00