Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/CSVStateMachine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,18 @@ public string[] ParseChunk(string chunk, bool reachedEnd)
return null;
}

//If the line ends with a qualifier and we're not at the end of the stream,
//it may be first qualifier from a doubled-up qualifier, so we should read the next chunk.
if (p2 == _line.Length - 1)
{
if (!reachedEnd)
{
// Backtrack one character so we can move forward when the next chunk loads
_position--;
return null;
}
}

// Append the text between the qualifiers
_work.Append(_line.Substring(_position + 1, p2 - _position - 1));
_position = p2;
Expand Down Expand Up @@ -273,4 +285,4 @@ public string[] ParseChunk(string chunk, bool reachedEnd)
return null;
}
}
}
}