Strip leading byte-order mark in graph CSV parser

Found while testing crates/engine/src/cmd/graph/data.rs:45-47 (parse_csv)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
NetterSilver
2026-11-09 15:25:52 +00:00
co-authored by Claude Haiku 5.5
parent 6dac80e75d
commit 511bb23999
2 changed files with 6 additions and 0 deletions
+1
View File
@@ -43,6 +43,7 @@ fn cell(c: &str) -> Cell {
}
pub(super) fn parse_csv(csv: &str) -> (Vec<String>, Vec<String>, Vec<Vec<Option<f64>>>) {
let csv = csv.strip_prefix('\u{feff}').unwrap_or(csv);
// Records end at line breaks outside quotes; a record is tab-separated if it has a tab outside quotes.
let rows: Vec<Vec<Cell>> = split_unquoted(csv, '\n')
.into_iter()
+5
View File
@@ -4205,3 +4205,8 @@ fn character_formats_are_kept_and_bigger_labels_space_out() {
}
}
}
#[test]
fn csv_leading_byte_order_mark_is_ignored() {
assert_eq!(super::parse_csv("\u{feff}1,2\n3,4"), super::parse_csv("1,2\n3,4"));
}