On 11/25/13 1:38 PM, Joe Hourcle wrote:
> On Nov 25, 2013, at 1:05 PM, Jonathan Rochkind wrote:
>> Ah, but what if the data itself has tabs! Doh!
>> It can be a mess either way. There are standards (or conventions?)
>> for escaping internal commas in CSV -- which doesn't mean the
>> software that was used to produce the CSV, or the software you are
>> using to read it, actually respects them.
> You don't have to escape the commas, you just have to double-quote
> the string. If you want to have a double quote, you put two in a
> row:, eg:
> "He said, ""hello"""
Right, I would call that a form of escaping.
I can stay blissfully ignorant of what form of escaping is required by
CSV and if I'm doing it right by just using a library, heh.
Out of curiosity, let's see what the ruby stdlib csv parser/writer
writes for various things.
Yep, just doublequotes anything with internal commas or quotes.
ordinary,row,with a value with spaces
a row with,"several, internal, commas"
or even,"internal ""quotes"", as the kids say"