You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Normal,\"quoted with nested \"double\" quotes, and comma at the end,\",normal 3,normal 4,normal 5"
will count 2 columns instead of 5.
Note, there is a nested double quotes, which with that alone it passes the test correctly (5 columns); but if you add a comma at the very end of the column (2nd column in this case) it will evaluate to only 2 columns instead of 5.
The text was updated successfully, but these errors were encountered:
I just realized that it would be helpful to represent this input text as a C# raw literal: """Normal,"quoted with nested ""double"" quotes, and comma at the end,",normal 3,normal 4,normal 5"""
This literal will fail!
Again note, there is a nested double quotes, which with that alone it passes the test correctly (5 columns); but if you add a comma at the very end of the column (2nd column in this case) it will evaluate to only 2 columns instead of 5.
Here is a test case:
//Arrange...
var options = new CsvOptions // Defaults
{
Separator = ',',
HeaderMode = HeaderMode.HeaderAbsent, // Assumes first row is a header row
AllowNewLineInEnclosedFieldValues = true, // Respects new line (either \r\n or \n) characters inside field values enclosed in double quotes.
};
string input = """Normal,"quoted with nested ""double"" quotes, and comma at the end,",normal 3,normal 4,normal 5""";
//Act...
var data = CsvReader.ReadFromText(input, options).First();
//Assert...
Assert.AreEqual(5, data.ColumnCount);
This csv row:
will count 2 columns instead of 5.
Note, there is a nested double quotes, which with that alone it passes the test correctly (5 columns); but if you add a comma at the very end of the column (2nd column in this case) it will evaluate to only 2 columns instead of 5.
The text was updated successfully, but these errors were encountered: