A UTF-8 BOM Makes the First Device CSV Column Disappear
Level 2 · node · Data · First CSV header mismatched because of UTF-8 BOM
Scenario
A fictional facility management service imports device IDs and installation zones from simple CSV files. Some field editors prefix UTF-8 CSV files with a byte-order mark. Ordinary files import correctly, but files containing a BOM cause the first column name to be interpreted differently, so valid rows are rejected as missing device IDs. Trace the flow from the CSV parser into the import service.
Requirements
Treat a single UTF-8 BOM at the very beginning of the CSV document as an encoding marker rather than part of the first header. Continue supporting ordinary files without a BOM. Reject rows missing a device ID or installation zone while preserving correct import counts and stored values for valid rows.
Acceptance criteria
- A valid CSV without a BOM imports its device.
- The first column in a CSV beginning with a UTF-8 BOM maps correctly and imports.
- Multiple valid rows in a CSV with a BOM all import.
- Rows with a missing required field are rejected and not stored.