Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

CSVs were simpler back in the 80s, when there were a few products (e.g. - Lotus 123, xBASE) that all wrote RFC 4180 compliant text (and I'm pretty sure there was no RFC 4180 yet)

No alternate delimiters, no backslashes.

Now I have to put up with offshore staff trying to use apostrophes (') instead of quotes (") :-(

Barring alternate delimiters, and disallowing newlines* in fields, I can write the parser for 4180 in about 30 lines of perl, reading a char at a time and flipping between about 4 states. (avoids getting root access and days of paperwork to install from CPAN)

* disallowing newlines in the data is admittedly a big restriction, but it works for many use-case/applications, and allows the caller to pull in a line before calling the parse function.

For Java, the "Ostermiller" library is pretty good for CSV handling, and has a few options for dealing with freaky variants.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: