David said:
Excel expects quotes within the field to be doubled. In fact, I
would go so far as to say FoxPro is wrong.
I would agree FoxPro is wrong. It appears to require (based on the
spec presented upthread), seeing the two-character sequence (",) or
the two-character sequence ("<newline>). That is, if the field
started with the (") character.
I might look for the three-character sequence (",") (or "<newline>),
but I still think this is a broken spec. Without being able to
escape the double-quote, you simply can't guarentee that there isn't
a valid delimiter sequence instring.
Also, this spec requires control of the CSV *emitter* (which, to me,
lacks robustness). The spec requires the writer of the values be
sure to not include spaces--in this case, between the final quote
and the comma. I'd rather a CSV reader that can handle:
" " , foobar , 42 , "Hello, World!" ,, , "Jonas ""J"" Jamison",
Without worrying about padding spaces around the commas.
What's maybe more an issue is how quotes are escaped. One standard
(used by MS and others) is doubling the quote. The other common one
uses an "escape char", such as the backslash. A *really* good CSV
parser should, IMO, detect both *AND* allow for single-quoting as
well as double-quoting.