Media Type "text/csv": new draft (-02) and Last Call

clyde.ingram at edl.uk.eds.com clyde.ingram at edl.uk.eds.com
Tue Mar 22 17:51:36 CET 2005


In section "2.Definition of the CSV format", items 3 & 4 state:

3. There maybe an optional header line appearing as the first line of the
file with the same format as normal record lines. This header will contain
names corresponding to the fields in the file and will usually contain the
same number of fields as the records in the rest of the file. For example: 

field_name,field_name,field_name CRLF
aaa,bbb,ccc CRLF
zzz,yyy,xxx CRLF 
4. Within the header and each record there may be one or more fields,
delimited by commas. The last field in the record may or may not be followed
by a comma. For example: 

aaa,bbb,ccc 

Why would you permit the last field in the record to be followed by a comma?
If a CSV record comprises:

aaa,,ccc,ddd,,CRLF

does it have 6 fields or 5?
If comma is a field separator only, there are 6 fields:

1. aaa
2. <null>
3. ccc
4. ddd
5. <null>
6. <null>

But if the comma is also a mandatory terminator for the last field
(effectively the record separator becomes comma-CRLF), then there are 5
fields.

In my view, permitting the last field to end with comma leads to ambiguity,
and prevents an application from checking that an exact number of fields is
present.  The only way to guarantee the exact number of fields is then to
count the fields in the header.  But then your item 3 allows the header
record to be omitted.

Would it not be safer to make the header record mandatory?

Thank-you and regards,
Clyde Ingram

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.alvestrand.no/pipermail/ietf-types/attachments/20050322/4e13e2df/attachment.html


More information about the Ietf-types mailing list