To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.publishOpen lugnet.publish in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Publishing / 2480
2479  |  2481
Subject: 
CSV delimiters
Newsgroups: 
lugnet.admin.database, lugnet.off-topic.geek, lugnet.publish
Date: 
Sat, 23 Sep 2000 06:18:50 GMT
Viewed: 
111 times
  
Is there any "official" or "reasonably standardized format" for CSV (_C_omma
_S_eparated _V_alue) data?

I guess it's pretty obvious, mostly, but how are the delimiter characters
typically encoded (specifically: comma, double-quote, and newline)?

In double-quotish strings (i.e., "foo foo foo"), how do you write a double-
quote (") within that string?  Do you escape it with \ and write \" or do you
double it up and write ""?  Can you write commas (,) inside double-quotish
strings or do those have to be escaped too?

What's a string?  Anything matching /[^0-9]/ or not matching /^[0-9]+$/ ?
(uh, plus any gunk for handling decimals and e+12 and all that funstuff).

I just downloaded a "CSV" version of my PayPal history and I thought this
was weird:  it put _everything_ (all fields, that is) in double-quotes --
even numerical fields.  But then it didn't put the header fields in quotes.
And it did also put a trailing comma on each line (hmm).

PayPal's CSV has unescaped commas within a double-quoted string field, BTW.
That seems fairly logical as long as they're putting strings in double-quotes
(dumb and wasteful compared to escaping the occasional comma or backslash,
but I guess it's too legacy not to do).

Anyway.  I don't expect there are hard answers to these sorts of questions but
if anyone knows if there's a BNF definition how popular apps, like, Micros~1
Excel interpret CSV, I could use some tips.

How CSV ever got to be any kind of text standard (over tab-delimited text)
is beyond me.  CSV stinks:  The probability of a comma occurring in text is
far greater than a tab character -- especially in many European currency
formats where "," is the decimal point and not ".".

--Todd



Message has 3 Replies:
  RE: CSV delimiters
 
(...) Sorry, I can't help. And I hate the way Excel outputs in plain text. But since it's 2:30 in the morning, I'll make useless comments. Sounds like you're working on the question I asked...augh, and I just entered all the sets manually. Oh well, (...) (24 years ago, 23-Sep-00, to lugnet.admin.database, lugnet.off-topic.geek, lugnet.publish)
  Re: CSV delimiters
 
(...) I remember looking for this about a year ago, and I came across something that looked very standardish. If I remember right, it's really silly. You don't actually escape things. Fields are comma separated, and optionally surrounded by (...) (24 years ago, 23-Sep-00, to lugnet.admin.database, lugnet.off-topic.geek, lugnet.publish)
  Re: CSV delimiters
 
Todd Lehman skrev i meddelandet ... (...) I see in the thread that you've got most of the answers you need, but there is at least one complication in the Windows world (if you ever get files from that): The MS programs (and many others too, as (...) (24 years ago, 23-Sep-00, to lugnet.admin.database, lugnet.off-topic.geek, lugnet.publish)

12 Messages in This Thread:




Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    
Active threads in Database

 
LUGNET Guide updates (Sun 24 Nov 2024)
14 hours ago
Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR