[Csv] Devil in the details, including the small one between delimiters and quotechars

Andrew McNamara andrewm at object-craft.com.au
Fri Jan 31 00:19:37 CET 2003


>Cliff> 1,"not quoted" ,"quoted"
>
>Why wouldn't you include the trailing space on the second field?
>
>Andrew, what does Excel do here?

Excel returns the trailing space, and honours the quote:

['1', 'not quoted ', 'quoted']

I've checked that it does this consistently (at end of line, etc).

>Hmm...  I was sort of expecting _csv to do this:
>
>['1', 'not quoted" ', 'quoted']

That would have been something I fixed when doing the extensive Excel
comparison - it's one of the tests.

>Cliff> Worse, consider this
>Cliff> "quoted", "not quoted, but this ""field"" has delimiters and quotes"
>
>Skip> Depends on the setting of skipinitialspaces.  If false, you get
>Skip>   ['quoted', ' "not quoted', ' but this ""field"" has delimiters and quotes"']
>
>parser does this:
>
>['quoted', ' "not quoted', ' but this ""field"" has delimiters and quotes"']

If we implement the "leading whitespace strip" then it would return:

['quoted', 'not quoted, but this "field" has delimiters and quotes']

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


More information about the Csv mailing list