3 ms·
Is there an open source library for parsing CSVs that has matured to cover 99.9% of edge cases, errors, etc.? We've had decades to build one. Otherwise, many pr
by wolverine876 3y ago
Is there an open source library for parsing CSVs that has matured to cover 99.9% of edge cases, errors, etc.? We've had decades to build one. Otherwise, many projects must be recreating this wheel.
- johnnyo 3y agoI don’t think so, because their are always ambiguities with CSVs Do they have a header? Is the data properly escaped? How are blank values at the end of the row handled? Etc, etc
- wolverine876 3y ago> their are always ambiguities with CSVs Right, that's the point of a good library, to handle the ambiguities via insightful coding solutions, accumulated over decades - enough solutions to make it worth using the library. Other ambiguities can be handled with Q&A which result in automated solutions: 'the text looks like either X or Y, which is it?', and then disambiguating the text based on the answer. Another benefit would be that, if the library became useful and widely used enough, it would become an unofficial standard: people would make CSV's compatible with the library and its output would become a norm. All a happy fantasy! :)
- johnnyo 3y agoInsightful solutions aren’t always correct solutions. Take a look at how Excel helpfully makes things dates or numbers, even when you don’t want them to be treated as such. There’s no “insightful” way to understand that a column of numbers really wants to be treated like text or that 20-DEC-82 is a product code vs a date.
- marcinzm 3y agoThere's plenty that can perfectly parse RFC 4180 since it's a very simple format. That's not, however, what people want in terms of parsing "CSV" files. They want to parse a file that contains data in some type of delimited format into some type of arbitrary format they envision. The delimiter may not even be a comma.