Merge pull request #6325 from Silvertree2010/fix/h15445-graph-csv-parser-does-not-strip

Strip leading byte-order mark in graph CSV parser
This commit is contained in:
BFlat
2026-11-09 23:16:56 +07:00
committed by GitHub
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"));
}