[Csv] multi-character delimiters, take two

Andrew McNamara andrewm at object-craft.com.au
Thu Feb 6 23:52:59 CET 2003


>So I tried exporting
>it through the export interface on the management client which runs on
>Windows.  Lo and behold, there was a fairly nice looking CSV file, all
>fields quoted with '"', except...  the delimiter is two spaces.  I popped it
>up in XEmacs to be sure it wasn't a TAB.

You might find that two spaces never appear in the data fields, in which
case this might work:

        fields = line.split('  ')

BTW, have you tried using the csv parser with delimiter set to space,
and skipinitialspace set to true?

>So now I've encountered two examples (including my old client in Austria) of
>honest-to-goodness tabular data (that is, not fabricated by mad perl hackers
>out to trip us up with "well, what if?" games) where the delimiter between
>fields is more than a single character.  There are probably others out
>there, just waiting to be discovered.  Any chance the len(delimiter) == 1
>restriction could be relaxed?

Not without some hairy work on the state machine. The more complicated
we make the state machine, the more likely we are to let a nasty bug
slip through, so I'm rather reluctant.

-- 
Andrew McNamara, Senior Developer, Object Craft
http://www.object-craft.com.au/


More information about the Csv mailing list