ben-strasser / fast-cpp-csv-parser

fast-cpp-csv-parser
BSD 3-Clause "New" or "Revised" License
2.11k stars 440 forks source link

CSV files with LF as part of data #57

Closed wolframbeta closed 6 years ago

wolframbeta commented 6 years ago

So I'm trying to parse a .CSV file that has a data member that is distinguished by quotes, but contains line feed in it. Example line with 3 elements: Colors,3,"Red Blue Green" Is there a way to parse this with your tool? It seems to read: Colors,3,"Red, and then throw an escaped string not closed error, or a not enough columns error if i dont use escape strings. Any solutions?

ben-strasser commented 6 years ago

Hi,

Thanks for the feedback. Unfortunately, newlines in quotes are not supported. There are technical reasons for this but I also consider CSV files where a row spans multiple lines broken. There are older issues on github that contain a more detailed rational as to why.

Best Regards Ben Strasser

On 11/09/2017 07:41 AM, wolframbeta wrote:

So I'm trying to parse a .CSV file that has a data member that is distinguished by quotes, but contains line feed in it. Example line with 3 elements: Colors,3,"Red Blue Green" Is there a way to parse this with your tool? It seems to read: Colors,3,"Red, and then throw an escaped string not closed error, or a not enough columns error if i dont use escape strings. Any solutions?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ben-strasser/fast-cpp-csv-parser/issues/57, or mute the thread https://github.com/notifications/unsubscribe-auth/ALaAj3BXfOrJ2Za6KjU5zH6PASIJcOeUks5s0p6ZgaJpZM4QXgKR.

paulharris commented 6 years ago

You could try my library, https://github.com/paulharris/cppcsv

It supports all that kind of thing. Not sure if its faster than fast-cpp-csv-parser, but its pretty quick.

On 9 November 2017 at 15:49, ben-strasser notifications@github.com wrote:

Hi,

Thanks for the feedback. Unfortunately, newlines in quotes are not supported. There are technical reasons for this but I also consider CSV files where a row spans multiple lines broken. There are older issues on github that contain a more detailed rational as to why.

Best Regards Ben Strasser

On 11/09/2017 07:41 AM, wolframbeta wrote:

So I'm trying to parse a .CSV file that has a data member that is distinguished by quotes, but contains line feed in it. Example line with 3 elements: Colors,3,"Red Blue Green" Is there a way to parse this with your tool? It seems to read: Colors,3,"Red, and then throw an escaped string not closed error, or a not enough columns error if i dont use escape strings. Any solutions?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ben- strasser/fast-cpp-csv-parser/issues/57, or mute the thread < https://github.com/notifications/unsubscribe-auth/ ALaAj3BXfOrJ2Za6KjU5zH6PASIJcOeUks5s0p6ZgaJpZM4QXgKR>.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ben-strasser/fast-cpp-csv-parser/issues/57#issuecomment-343073518, or mute the thread https://github.com/notifications/unsubscribe-auth/ABkgS2UXU8jSC-kcIVqmhxHtCC4Ogcl7ks5s0q5ugaJpZM4QXgKR .