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

CSV is fine. If you care about edge cases, implement RFC 4180:

https://www.rfc-archive.org/getrfc.php?rfc=4180

If you don't, then split each line on ",". Problem solved.

If you find tab delimited easier to read (as I do), then check out the IANA spec for TSV files:

https://www.iana.org/assignments/media-types/text/tab-separa...

It's easier to parse than CSV. Unfortunately, you have to decide how to handle newlines and tabs yourself (probably as \n, \t, with \\ for backslashes).




> If you don't, then split each line on ",". Problem solved.

And the millionth bad CSV parser is born.


More than the millionth, I'm sure. If you know your input doesn't have commas (for example, because you generated it) and the code is throwaway, then splitting on comma is fine.

But, yeah, I prefer tab delimited, since "no commas" is painful, and data that contains quotes leads to scenarios where the crappy CSV I generated can't be parsed by RFC 4180 parsers.


yeah the "CSV is fine" bit scared me. people think they know what everyone is doing and why; in reality (where these problems actually need to be solved) no one knows.


> If you don't, then split each line on ",". Problem solved.

What? Real data contains '"' quote character too. That doesn't work.


Read the RFC I linked. It handles all the characters.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: