We have an integration with another system that relies on passing CSV files back and forth (really old school).
The structure is generally:
ID, Name, PhoneNumber, comments, fathersname 1, tom, 555-1234, just some random text, bill 2, jill smith, 555-4234, other random text, richard Every so often we see this:
3, jacked up, 999-1231, here be dragons amongst us, ted The primary problem I care about is detecting that a line breaker (\n) occurs in the middle of the record when that is the record terminator.
Is there anyway I can preprocess this to reliably fix it?
Note that we have zero control over what the other system emits.
throw new FormatException();. I don't think most formatters will be able to handle this, without quotes around the field; you'll need to roll your own.,characters on a new line and if it is 0 than it is not actually a new record.