7c7 < Expires: August 6, 2005 February 2, 2005 --- > Expires: August 20, 2005 February 16, 2005 10,11c10,11 < MIME Type for CSV Files < draft-shafranovich-mime-csv-00.txt --- > Common Format and MIME Type for CSV Files > draft-shafranovich-mime-csv-01.txt 38c38 < This Internet-Draft will expire on August 6, 2005. --- > This Internet-Draft will expire on August 20, 2005. 46,48c46,47 < This document defines MIME types "text/csv" and < "text/comma-separated-values" which used for Comma-Separated Values < (CSV) files. --- > This document documents the format used for Comma-Separated Values > (CSV) files and registers the associated MIME type "text/csv". 56c55,56 < Shafranovich Expires August 6, 2005 [Page 1] --- > > Shafranovich Expires August 20, 2005 [Page 1] 58c58 < Internet-Draft MIME Type for CSV Files February 2005 --- > Internet-Draft Common Format and MIME Type for CSV FilesFebruary 2005 64,77c64,77 < 2. MIME Type Registration of text/csv and < text/comma-separated-values . . . . . . . . . . . . . . . . . 3 < 3. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 4 < 4. Security Considerations . . . . . . . . . . . . . . . . . . . 5 < 5. References . . . . . . . . . . . . . . . . . . . . . . . . . . 5 < 5.1 Normative References . . . . . . . . . . . . . . . . . . . 5 < 5.2 Informative References . . . . . . . . . . . . . . . . . . 5 < Author's Address . . . . . . . . . . . . . . . . . . . . . . . 5 < A. Appendix A - Discussion of the CSV format . . . . . . . . . . 6 < Intellectual Property and Copyright Statements . . . . . . . . 8 < < < < --- > 2. Definition of the CSV format . . . . . . . . . . . . . . . . . 3 > 3. MIME Type Registration of text/csv . . . . . . . . . . . . . . 5 > 4. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 6 > 5. Security Considerations . . . . . . . . . . . . . . . . . . . 6 > 6. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 6 > 7. References . . . . . . . . . . . . . . . . . . . . . . . . . . 6 > 7.1 Normative References . . . . . . . . . . . . . . . . . . . 6 > 7.2 Informative References . . . . . . . . . . . . . . . . . . 7 > Author's Address . . . . . . . . . . . . . . . . . . . . . . . 7 > A. Status of This Document [To Be Removed Upon Publication] . . . 7 > A.1 Discussion Venue . . . . . . . . . . . . . . . . . . . . . 7 > A.2 Document Repository . . . . . . . . . . . . . . . . . . . 7 > A.3 Document History . . . . . . . . . . . . . . . . . . . . . 8 > Intellectual Property and Copyright Statements . . . . . . . . 9 112c112 < Shafranovich Expires August 6, 2005 [Page 2] --- > Shafranovich Expires August 20, 2005 [Page 2] 114c114 < Internet-Draft MIME Type for CSV Files February 2005 --- > Internet-Draft Common Format and MIME Type for CSV FilesFebruary 2005 121,123c121,123 < some time. Surprisingly, while this file is very common it has never < been formally documented. Additionally, while the IANA MIME < registration tree includes a registraton for --- > some time. Surprisingly, while this format is very common it has > never been formally documented. Additionally, while the IANA MIME > registration tree includes a registration for 128,129c128,219 < seeks to formally register two MIME types for CSV in accordance with < RFC 2048 [4]. --- > seeks to document the format of comma separated values (CSV) files > and to formally register the "text/csv" MIME type for CSV in > accordance with RFC 2048 [4]. > > 2. Definition of the CSV format > > While there are various specifications and implementations for the > CSV format (for ex. [5], [6], [7] and [8]), no formal specification > exists which causes a wide variety of interpretations for CSV files. > This section seeks to document the format that seems to be followed > by most implementations: > > 1. Each record is located on a separate line delimited by a line > break (CRLF). For example: > > aaa,bbb,ccc CRLF > zzz,yyy,xxx CRLF > > 2. The last record in the file may or may not have an ending > linebreak. For example: > > aaa,bbb,ccc CRLF > zzz,yyy,xxx > > 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: > > > > Shafranovich Expires August 20, 2005 [Page 3] > > > aaa,bbb,ccc > > 5. Each field may or may not be enclosed in double quotes (however > some programs such as Microsoft Excel do not use double quotes at > all). For example: > > "aaa","bbb","ccc" CRLF > zzz,yyy,xxx > > 6. Field containing line breaks (CRLF) and commas should be enclosed > in double-quotes. For example: > > "aaa","b CRLF > bb","ccc" CRLF > zzz,yyy,xxx > > 7. If double-quotes are used to enclosed fields, then double-quotes > inside fields must be surounded by double quotes. For example: > > "aaa","b"""bb","ccc" > > The ABNF grammar [1] appears as follows: > > file = [header CRLF] record *(CRLF record) [CRLF] > > header = name *(COMMA name) > > record = field *(COMMA field) > > name = field > > field = (escaped / non-escaped) > > escaped = DQUOTE *(VCHAR / CR / LF / CRLF / 3*DQUOTE) DQUOTE > > non-escaped = *VCHAR > > COMMA = %x2C > > CR = %x0D ;as per section 6.1 of RFC 2234 [1] > > LF = %x0A ;as per section 6.1 of RFC 2234 [1] > > CRLF = CR LF ;as per section 6.1 of RFC 2234 [1] > > VCAR = %x21-7E ;as per section 6.1 of RFC 2234 [1] > > > 131c221,229 < 2. MIME Type Registration of text/csv and text/comma-separated-values --- > > > > Shafranovich Expires August 20, 2005 [Page 4] > > Internet-Draft Common Format and MIME Type for CSV FilesFebruary 2005 > > > 3. MIME Type Registration of text/csv 139,140c237 < Subject: Registration of MIME media types text/csv and < text/comma-separated-values --- > Subject: Registration of MIME media type text/csv 144c241 < MIME subtype name: csv, comma-separated-values --- > MIME subtype name: csv 155,159c252,254 < While section 4.1.1. of RFC 2046 [1] stipulates that "text" < subtypes MUST use a CRLF sequence as a line break, in practice < that is not always true for CSV. Therefore, implementors should < be aware that either CR or CRLF maybe used as a line break for < this format. --- > As per section 4.1.1. of RFC 2046 [2], this media type uses CRLF > to denote line breaks. However, implementors should be aware that > some implementations may use other values. 165,172d259 < < < < Shafranovich Expires August 6, 2005 [Page 3] < < Internet-Draft MIME Type for CSV Files February 2005 < < 175,176c262,263 < maybe shared via this format which of course applies to any text < data. --- > maybe shared via this format (which of course applies to any text > data). 181,186c268,271 < differences among different implementations as described in < appendix A. The most common difference among various format is < whether double quotes (") are used to enclose strings. < Implementors should "be conservative in what you do, be liberal in < what you accept from others" (RFC 793 [2]) when processing CSV < files. --- > differences among different implementations. Implementors should > "be conservative in what you do, be liberal in what you accept > from others" (RFC 793 [3]) when processing CSV files. An attempt > at a common definition can be found in Section 2. 192,193c277,286 < format. A sampling of formats and discussion of differences is < included in appendix A. --- > > > > Shafranovich Expires August 20, 2005 [Page 5] > > Internet-Draft Common Format and MIME Type for CSV FilesFebruary 2005 > > > format. An attempt at documentating a common definition can be > found in Section 2. 215c308 < 3. IANA Considerations --- > 4. IANA Considerations 217,219c310,312 < After IESG approval, IANA is expected to register these two types < "text/csv" and "text/comma-separated-values" using the application < provided in this document. --- > After IESG approval, IANA is expected to register the MIME type > "text/csv" using the application provided in Section 3 of this > document. 220a314 > 5. Security Considerations 221a316 > See discussion above 222a318 > 6. Acknowledgments 224,226c320,322 < Shafranovich Expires August 6, 2005 [Page 4] < < Internet-Draft MIME Type for CSV Files February 2005 --- > The author would like to thank Dave Crocker, Martin Duerst and Bruce > Lilly for their helpful suggestions. A special word of thanks to > Dave for helping with the ABNF grammar. 227a324 > 7. References 229c326 < 4. Security Considerations --- > 7.1 Normative References 231c328,329 < See discussion above --- > [1] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax > Specifications: ABNF", RFC 2234, November 1997. 233c331,338 < 5. References --- > [2] Freed, N. and N. Borenstein, "Multipurpose Internet Mail > Extensions (MIME) Part Two: Media Types", RFC 2046, November > > > > Shafranovich Expires August 20, 2005 [Page 6] > > Internet-Draft Common Format and MIME Type for CSV FilesFebruary 2005 235d339 < 5.1 Normative References 237,238d340 < [1] Freed, N. and N. Borenstein, "Multipurpose Internet Mail < Extensions (MIME) Part Two: Media Types", RFC 2046, November 241c343 < [2] Postel, J., "Transmission Control Protocol", STD 7, RFC 793, --- > [3] Postel, J., "Transmission Control Protocol", STD 7, RFC 793, 244,247c346 < [3] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax < Specifications: ABNF", RFC 2234, November 1997. < < 5.2 Informative References --- > 7.2 Informative References 276a376 > Appendix A. Status of This Document [To Be Removed Upon Publication] 277a378 > A.1 Discussion Venue 278a380,383 > Discussion about this document should be directed to the IETF-TYPES > mailing list > which is also reachable via . Of course, > comments directly to the author are always welcome. 280,282c385 < Shafranovich Expires August 6, 2005 [Page 5] < < Internet-Draft MIME Type for CSV Files February 2005 --- > A.2 Document Repository 283a387,388 > Copies of this and earlier versions including multiple formats can be > found at . 285d389 < Appendix A. Appendix A - Discussion of the CSV format 287,295d390 < While there are various specifications and implementations for the < CSV format (for ex. [5], [6], [7] and [8]), no formal specification < exists. This causes a wide variety of interpretations for CSV files. < While this document does not seek to document the CSV format, < nevertheless we want to document the format that seems to be followed < by most implementations: < < 1. Each record is located on a separate line delimited by a line < break (either CR or CR/LF). For example: 297,318c392,394 < aaa,bbb,ccc CRLF < zzz,yyy,xxx CRLF < < 2. The last record in the file may or may not have an ending < linebreak. For example: < < aaa,bbb,ccc CRLF < zzz,yyy,xxx < < 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: --- > Shafranovich Expires August 20, 2005 [Page 7] > > Internet-Draft Common Format and MIME Type for CSV FilesFebruary 2005 320d395 < aaa,bbb,ccc 322,324c397 < 5. Each field may or may not be enclosed in double quotes, however < some programs such as Microsoft Excel do not use double quotes at < all. For example: --- > A.3 Document History 326,327c399,400 < "aaa","bbb","ccc" CRLF < zzz,yyy,xxx --- > Changes from draft-shafranovich-mime-csv-00 to > draft-shafranovich-mime-csv-01: 329,330c402 < 6. Field containing line breaks (CR or CR/LF) and commas should be < enclosed in double-quotes. For example: --- > o Type "text/comma-separated-values" has been removed 332c404,406 < "aaa","b CRLF --- > o The "encoding consideration" paragraph of Section 3 has been > changed to allow CRLF only as per section 4.1.1. of RFC 2046 [2]. > This has been reflected in the ABNF grammar in Section 2. 333a408 > o ABNF grammar in Section 2 has been cleaned up. 334a410 > o Acknowledgements and status sections were added. 336,338c412,413 < Shafranovich Expires August 6, 2005 [Page 6] < < Internet-Draft MIME Type for CSV Files February 2005 --- > o CSV format definition was moved to the normative section of the > document 341,342d415 < bb","ccc" CRLF < zzz,yyy,xxx 344,345d416 < 7. If double-quotes are used to enclosed fields, then double-quotes < inside fields must be surounded by double quotes. For example: 347d417 < "aaa","b"""bb","ccc" 349,350d418 < 8. Whitespace immediately before and after commas maybe removed < unless it appears inside double-quotes. For example: 352d419 < zzz, yyy , xxx 354d420 < would be processed as if it was: 356d421 < zzz,yyy,xxx 358d422 < The ABNF grammar [3] appears as follows: 360d423 < COMMA = %x2C 362d424 < file = [header] *record 364d425 < end-of-field = COMMA / (CR / CRLF) 366d426 < header = *(*WSP field *WSP end-of-field) 368d427 < record = *(*WSP field *WSP end-of-field) 370d428 < field = escaped / non-escaped 372d429 < escaped = DQUOTE *(VCHAR / CR / CRLF / 3*DQUOTE) DQUOTE 374d430 < non-escaped = *VCHAR 392c448 < Shafranovich Expires August 6, 2005 [Page 7] --- > Shafranovich Expires August 20, 2005 [Page 8] 394c450 < Internet-Draft MIME Type for CSV Files February 2005 --- > Internet-Draft Common Format and MIME Type for CSV FilesFebruary 2005 448c504 < Shafranovich Expires August 6, 2005 [Page 8] --- > Shafranovich Expires August 20, 2005 [Page 9]