mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-10 11:11:30 +00:00
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:
@@ -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()
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user