News for hackers. Stuff that matters.
Re:A love letter to the CSV format by LoganDark on Wednesday March 26, 2025 @05:03PM (#43487286)
Decimal separators being commas in some locales?
Re:A love letter to the CSV format by otikik on Wednesday March 26, 2025 @05:29PM (#43487548)
They could have just ignored the locale altogether though. Put dots on the numbers when using csv, and assume it has dots when importing
Re:A love letter to the CSV format by notpushkin on Thursday March 27, 2025 @02:09AM (#43490786)
This exactly. Numbers in XLS(X) are (hopefully) not locale-specific – why should they be in CSV?
Re:A love letter to the CSV format by afiori on Thursday March 27, 2025 @04:47AM (#43491536)
CSV -> text/csv

Microsoft Excel -> application/vnd.ms-excel

CSV is a text format, xls[x], json, and (mostly) xml are not.

Re:A love letter to the CSV format by ideamotor on Wednesday March 26, 2025 @05:23PM (#43487463)
Commas are commonly used in text, too.
Re:A love letter to the CSV format by susam on Wednesday March 26, 2025 @07:14PM (#43488583)
Clearly they should have gone with BEL as the delimiter.

  printf "alice\007london\007uk\nbob\007paris\007france\n" > data.bsv
I'm hoping no reasonable person would ever use BEL as punctuation or decimal separator.
Re:A love letter to the CSV format by kmoser on Wednesday March 26, 2025 @11:12PM (#43490039)
On the off chance you're not being facetious, why not ASCII 0 as a delimiter? (This is a rhetorical question.)
Re:A love letter to the CSV format by defrost on Wednesday March 26, 2025 @11:17PM (#43490075)
There are some decent arguments for BEL over NUL, however given you posed that as a rhetorical question I feel I can say little other than

ding! ding! ding! winner winner, chicken dinner!

Although BEL would drive me up the wall if I broke out any of my old TTY hardware.

Re:A love letter to the CSV format by mastax on Thursday March 27, 2025 @01:26AM (#43490607)
ASCII has characters more or less designed for this

0x1C - File Separator

0x1D - Group Separator

0x1E - Record Separator

0x1F - Unit Separator

So I guess 1F would be the "comma" and 1E would be the "newline."

Re:A love letter to the CSV format by afiori on Thursday March 27, 2025 @04:54AM (#43491573)
https://stackoverflow.com/questions/8695118/what-are-the-fil...

I am pretty sure you shifted the meaning, the decimal separator is part of the atomic data it does not need a control character.

You would use 1F instead of the comma/semicolon/tab and 1E to split lines (record means line just like in SQL).

You could then use 1D to store multiple CSV tables in a single file.

Re:A love letter to the CSV format by pasc1878 on Thursday March 27, 2025 @07:20AM (#43492419)
Yes but then the text is not human readable or editable in a plain text editor.

This would confuse most users of csvs they are not programmers they at most use text editors and Excel.

Re:A love letter to the CSV format by afiori on Thursday March 27, 2025 @12:18PM (#43495155)
I am not proposing to do this, but if you were to use ascii separators you would do it this way
Re:A love letter to the CSV format by dessimus on Thursday March 27, 2025 @06:25AM (#43492052)
If one was going to use a non-printable character as a delimiter, why wouldn't they use the literal record separator "\030"?
Re:A love letter to the CSV format by susam on Thursday March 27, 2025 @07:50PM (#43499637)
Every time you cat a BSV file, your terminal beeps like it's throwing a tantrum. A record separator (RS) based file would be missing this feature! In other words, my previous comment was just a joke! :)

By the way, RS is decimal 30 (not octal '\030'). In octal, RS is '\036'. For example:

  $ printf '\036' | xxd -p
  1e
  $ printf '\x1e' | xxd -p
  1e
See also https://en.cppreference.com/w/cpp/language/ascii for confirmation.
Re:A love letter to the CSV format by kevindamm on Wednesday March 26, 2025 @10:09PM (#43489734)
...and excel macros
Re:A love letter to the CSV format by LoganDark on Thursday March 27, 2025 @02:46AM (#43490984)
Sure, let's put quotation marks around all number values.

Oh wait.

lol