Live data from Hacker News

Why people use CSV instead of DSV?

news.ycombinator.com

1–7 of 7 posts

Why people use CSV instead of DSV?

#1
It seems that most of the people use CSV instead of DSV. Why?

At least at the first glance, DSV seems to be a much better format. It is equally powerful, but much more cleaner and reliable.

About DSV and DSV-versus-CSV:

* http://www.catb.org/~esr/writings/taoup/html/ch05s02.html#id2901882

* https://en.wikipedia.org/wiki/Delimiter-separated_values

Consider the following table (column - text):

1 - aaa

2 - bbb bbb

3 - ccc, ccc

4 - ddd "ddd"

In CSV: aaa,bbb bbb,"ccc, ccc","ddd ""ddd"""

In DSV: aaa,bbb bbb,ccc\, ccc,ddd "ddd"

A quote from https://wiki.c2.com/?DelimiterSeparatedValues:

> DelimiterSeparatedValues files and CommaSeparatedValues are equally powerful, but the reading and writing algorithms for CSV have to maintain more state than the ones for DSVs, and so different CSV implementations end up implementing slightly different rules. Therefore using DelimiterSeparatedValues is closer to DoTheSimplestThingThatCouldPossiblyWork.

I don't understand what the author mean. I don't see how _"the reading and writing algorithms for CSV have to maintain more state than the ones for DSVs"_ leads to _"and so different CSV implementations end up implementing slightly different rules"_.

Also, are there any DSV editors on the market?

Re: Why people use CSV instead of DSV?

#6
Afaik CSV is only a subset of DSV as indicated by the name: Comma VS Delimiter separated values. A delimiter can be all kinds of things, while comma is just a comma. However, the name is misused in popular tools, which actually do use other delimiters than comma, but still call it CSV. Any DSV reader in theory should be able to read any CSV file, unless the people implementing something and calling it CSV did not think about the meaning of the words.

Re: Why people use CSV instead of DSV?

#7

Afaik CSV is only a subset of DSV as indicated by the name: Comma VS Delimiter separated values. A delimiter can be all kinds of things, while comma is just a comma. However, the name is misused in popular tools, which actually do use other delimiters than comma, but still call it CSV. Any DSV reader in theory should be able to read any CSV file, unless the people implementing something and calling it CSV did not thi…

It's not so. Both CSV (despite of its name) and DSV are able to use an arbitrary character as a delimiter. The real difference between them is the way to escape the delimiter (and to escape the escaper itself). DSV use C-like syntax: \, will be treated as literal comma, \\ will be treated as literal backslash. CSV use quotation marks for this purpose, and in a completely different way.