Skip to content

Conversation

@yzi2004
Copy link

@yzi2004 yzi2004 commented Dec 8, 2025

Our CSV file has a column that contains JSON-formatted data, so it includes many doubled-up qualifier. We found that sometimes the fields are not split correctly.
During debugging, we found that when reading a chunk, if the read ends just before first qualifier of a doubled-up qualifier in json data, it causes an error.

Therefore, if the last character of a line is a qualifier and there is not end of stream, it should continue reading the next chunk.

`internal class Program
{
static void Main(string[] args)
{
var settings = new CSVSettings()
{
HeaderRowIncluded = true,
BufferSize = 119,
HeadersCaseSensitive = false
};

    string csvFile = "sample.csv";

    using (var csv = CSVReader.FromFile(csvFile, settings))
    {
        foreach (var line in csv.Lines())
        {
            Console.WriteLine(line[7]);
        }
    }
}

}
sample.csv
`

Handle cases where line ends with a qualifier and not at stream end.
@tspence
Copy link
Owner

tspence commented Dec 15, 2025

This is a really interesting find! Let me work on a test case for this so we can validate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants