5 ms·
oh boy. here's where it breaks - supporting "" (single) - Supporting newlines in "", oops, now you can't getline() and instead need to getdelim() - Supportin
by nmz 3y ago
oh boy. here's where it breaks
- supporting "" (single)
- Supporting newlines in "", oops, now you can't getline() and instead need to getdelim()
- Supporting comments # (why is this even a thing)
- Supporting multiple "" in a field
- Escaping " with "" or \"
- length based csv, so all fields are seekable.
It's a mess, which one's your csv?
- outop 3y agoThe vast majority of CSVs do not have strings which include either quotes or newlines. No CSV I have ever encountered has comments.
- eviks 3y agoSo you're fine with a lot of bugs in the case of a vast minority?
- outop 3y agoWell, most code that loads CSVs is intended to work with certain files from certain sources, and not with all the CSVs that have ever existed. So yes, I am happy with code that works for a subset of files. There are thousands of applications which work with CSVs and they all do exactly this.
- nmz 3y agoGoogle contacts does.
- outop 3y agoIt seems that Google generally try and find ways of making exporting their data to use in other services as painful as possible.
- nmz 3y agoYou need newlines in fields, because contacts has addresses, and addresses have newlines. (And also Notes, but that's not as important) (Oh and I forgot about headers, headers should be mandatory but people are aloof about it)