First Cut at CSV PEP

Kevin Altis altis at semi-retired.com
Tue Jan 28 16:20:21 CET 2003


The big issue with the MS/Excel CSV format is that MS doesn't appear to
escape any characters or support import of escaped characters. A field that
contains characters that you might normally escape (including a comma if
that is the separator) are instead enclosed in double quotes by default and
then any double quotes in the field are doubled.

I found this MySQL article where the dialogs show the emphasis on escape
characters.

http://www.databasejournal.com/features/mysql/article.php/10897_1558731_5

It doesn't seem like you would run into a case where a file would use the MS
CSV format and have escaped characters too, but perhaps these exist in the
wild.

On the export, I think you would want the option of specifying whether to
use field qualifiers (quotes) on all fields and then only optionally enclose
a field if qualifiers are needed. If you aren't generating MS CSV format and
are using escape sequences, the field "quotes" aren't needed. See the Export
Data as CSV dialog at the URL above.

I guess MySQL could be one of the dialects and that would be closer to what
everyone expects except MS? Ugh, I shouldn't try and think about this stuff
before morning coffee ;-)

ka

> -----Original Message-----
> From: Skip Montanaro [mailto:skip at pobox.com]
> Sent: Monday, January 27, 2003 8:20 PM
> To: LogiplexSoftware at earthlink.net; altis at semi-retired.com;
> csv at object-craft.com.au
> Subject: First Cut at CSV PEP
>
>
>
> I'm ready to toddle off to bed, so I'm stopping here for tonight.
>  Attached
> is what I've come up with so far in the way of a PEP.  Feel free to flesh
> out, rewrite or add new sections.  After a brief amount of cycling, I'll
> check it into CVS.
>
> Skip
>
>




More information about the Csv mailing list