diff --git a/crates/engine/src/cmd/graph/data.rs b/crates/engine/src/cmd/graph/data.rs index b49a0d6a8..3e2122349 100644 --- a/crates/engine/src/cmd/graph/data.rs +++ b/crates/engine/src/cmd/graph/data.rs @@ -43,6 +43,7 @@ fn cell(c: &str) -> Cell { } pub(super) fn parse_csv(csv: &str) -> (Vec, Vec, Vec>>) { + 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> = split_unquoted(csv, '\n') .into_iter() diff --git a/crates/engine/src/cmd/graph/tests.rs b/crates/engine/src/cmd/graph/tests.rs index 7acfc2c81..650a4275a 100644 --- a/crates/engine/src/cmd/graph/tests.rs +++ b/crates/engine/src/cmd/graph/tests.rs @@ -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")); +}