csv-conduit
csv-conduit copied to clipboard
New lines generated by Excel on Mac OS Handled Incorrectly
The CSV files generated or edited by Microsoft Excel on Mac OS use an outdated new line char \r
. The csv-conduit
library does not handle this case and throws an exception.
I had a look inside the csv-conduit ByteString
parser and it seems that the library is using the Attoparsec endOfLine
function, which does not handle the \r
case:
https://hackage.haskell.org/package/attoparsec-0.13.0.1/docs/src/Data-Attoparsec-ByteString-Internal.html
I think this is an important case since MS Excel on Mac is pretty common.
This fix is pretty simple, anyways. I can make a pull request, if you like.
I made a pull request that fixes this issue: https://github.com/ozataman/csv-conduit/pull/18
By the way, here is the error message that I get when parsing a CSV file generated by MS Excel on Mac:
main: ParseError {errorContexts = [], errorMessage = "endOfInput", errorPosition = 1:31}
This error doesn't appear anymore after applying my patch.