| draft-shafranovich-mime-csv-03.txt | draft-shafranovich-mime-csv-04.txt | |||
|---|---|---|---|---|
| Network Working Group Y. Shafranovich | Network Working Group Y. Shafranovich | |||
| Internet-Draft SolidMatrix Technologies, Inc. | Internet-Draft SolidMatrix Technologies, Inc. | |||
| Expires: September 24, 2005 March 23, 2005 | Expires: October 4, 2005 April 2, 2005 | |||
| Common Format and MIME Type for CSV Files | Common Format and MIME Type for CSV Files | |||
| draft-shafranovich-mime-csv-03.txt | draft-shafranovich-mime-csv-04.txt | |||
| Status of this Memo | Status of this Memo | |||
| This document is an Internet-Draft and is subject to all provisions | This document is an Internet-Draft and is subject to all provisions | |||
| of Section 3 of RFC 3667. By submitting this Internet-Draft, each | of Section 3 of RFC 3667. By submitting this Internet-Draft, each | |||
| author represents that any applicable patent or other IPR claims of | author represents that any applicable patent or other IPR claims of | |||
| which he or she is aware have been or will be disclosed, and any of | which he or she is aware have been or will be disclosed, and any of | |||
| which he or she become aware will be disclosed, in accordance with | which he or she become aware will be disclosed, in accordance with | |||
| RFC 3668. | RFC 3668. | |||
| skipping to change at page 1, line 35 | skipping to change at page 1, line 35 | |||
| and may be updated, replaced, or obsoleted by other documents at any | and may be updated, replaced, or obsoleted by other documents at any | |||
| time. It is inappropriate to use Internet-Drafts as reference | time. It is inappropriate to use Internet-Drafts as reference | |||
| material or to cite them other than as "work in progress." | material or to cite them other than as "work in progress." | |||
| The list of current Internet-Drafts can be accessed at | The list of current Internet-Drafts can be accessed at | |||
| http://www.ietf.org/ietf/1id-abstracts.txt. | http://www.ietf.org/ietf/1id-abstracts.txt. | |||
| The list of Internet-Draft Shadow Directories can be accessed at | The list of Internet-Draft Shadow Directories can be accessed at | |||
| http://www.ietf.org/shadow.html. | http://www.ietf.org/shadow.html. | |||
| This Internet-Draft will expire on September 24, 2005. | This Internet-Draft will expire on October 4, 2005. | |||
| Copyright Notice | Copyright Notice | |||
| Copyright (C) The Internet Society (2005). | Copyright (C) The Internet Society (2005). | |||
| Abstract | Abstract | |||
| This document documents the format used for Comma-Separated Values | This document documents the format used for Comma-Separated Values | |||
| (CSV) files and registers the associated MIME type "text/csv". | (CSV) files and registers the associated MIME type "text/csv". | |||
| Table of Contents | Table of Contents | |||
| 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 | 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 | |||
| 2. Definition of the CSV format . . . . . . . . . . . . . . . . . 3 | 2. Definition of the CSV format . . . . . . . . . . . . . . . . . 3 | |||
| 3. MIME Type Registration of text/csv . . . . . . . . . . . . . . 5 | 3. MIME Type Registration of text/csv . . . . . . . . . . . . . . 5 | |||
| 4. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 6 | 4. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 6 | |||
| 5. Security Considerations . . . . . . . . . . . . . . . . . . . 6 | 5. Security Considerations . . . . . . . . . . . . . . . . . . . 6 | |||
| 6. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 6 | 6. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 7 | |||
| 7. References . . . . . . . . . . . . . . . . . . . . . . . . . . 6 | 7. References . . . . . . . . . . . . . . . . . . . . . . . . . . 7 | |||
| 7.1 Normative References . . . . . . . . . . . . . . . . . . . 6 | 7.1 Normative References . . . . . . . . . . . . . . . . . . . 7 | |||
| 7.2 Informative References . . . . . . . . . . . . . . . . . . 7 | 7.2 Informative References . . . . . . . . . . . . . . . . . . 7 | |||
| Author's Address . . . . . . . . . . . . . . . . . . . . . . . 7 | Author's Address . . . . . . . . . . . . . . . . . . . . . . . 8 | |||
| A. Status of This Document [To Be Removed Upon Publication] . . . 7 | A. Status of This Document [To Be Removed Upon Publication] . . . 8 | |||
| A.1 Discussion Venue . . . . . . . . . . . . . . . . . . . . . 7 | A.1 Discussion Venue . . . . . . . . . . . . . . . . . . . . . 8 | |||
| A.2 Document Repository . . . . . . . . . . . . . . . . . . . 7 | A.2 Document Repository . . . . . . . . . . . . . . . . . . . 8 | |||
| A.3 Document History . . . . . . . . . . . . . . . . . . . . . 8 | A.3 Document History . . . . . . . . . . . . . . . . . . . . . 8 | |||
| Intellectual Property and Copyright Statements . . . . . . . . 9 | Intellectual Property and Copyright Statements . . . . . . . . 10 | |||
| 1. Introduction | 1. Introduction | |||
| The comma separated values format (CSV) has been used for exchanging | The comma separated values format (CSV) has been used for exchanging | |||
| and converting data between various spreadsheet programs for quite | and converting data between various spreadsheet programs for quite | |||
| some time. Surprisingly, while this format is very common it has | some time. Surprisingly, while this format is very common it has | |||
| never been formally documented. Additionally, while the IANA MIME | never been formally documented. Additionally, while the IANA MIME | |||
| registration tree includes a registration for | registration tree includes a registration for | |||
| "text/tab-separated-values" type, no MIME types have ever been | "text/tab-separated-values" type, no MIME types have ever been | |||
| registered with IANA for CSV. At the same time, various programs and | registered with IANA for CSV. At the same time, various programs and | |||
| skipping to change at page 3, line 43 | skipping to change at page 3, line 43 | |||
| 2. The last record in the file may or may not have an ending line | 2. The last record in the file may or may not have an ending line | |||
| break. For example: | break. For example: | |||
| aaa,bbb,ccc CRLF | aaa,bbb,ccc CRLF | |||
| zzz,yyy,xxx | zzz,yyy,xxx | |||
| 3. There maybe an optional header line appearing as the first line | 3. There maybe an optional header line appearing as the first line | |||
| of the file with the same format as normal record lines. This | of the file with the same format as normal record lines. This | |||
| header will contain names corresponding to the fields in the file | header will contain names corresponding to the fields in the file | |||
| and will usually contain the same number of fields as the records | and should contain the same number of fields as the records in | |||
| in the rest of the file. For example: | the rest of the file (the presence or absence of the header line | |||
| should be indicated via the optional "header" parameter of this | ||||
| MIME type). For example: | ||||
| field_name,field_name,field_name CRLF | field_name,field_name,field_name CRLF | |||
| aaa,bbb,ccc CRLF | aaa,bbb,ccc CRLF | |||
| zzz,yyy,xxx CRLF | zzz,yyy,xxx CRLF | |||
| 4. Within the header and each record there may be one or more | 4. Within the header and each record there may be one or more | |||
| fields, separated by commas. The last field in the record may | fields, separated by commas. Each line should contain the same | |||
| not be followed by a comma. For example: | number of fields throughout the file. The last field in the | |||
| record may not be followed by a comma. For example: | ||||
| aaa,bbb,ccc | aaa,bbb,ccc | |||
| 5. Each field may or may not be enclosed in double quotes (however | 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 | some programs such as Microsoft Excel do not use double quotes at | |||
| all). For example: | all). If fields are not enclosed with double quotes, then double | |||
| quotes may not appear inside the fields. For example: | ||||
| "aaa","bbb","ccc" CRLF | "aaa","bbb","ccc" CRLF | |||
| zzz,yyy,xxx | zzz,yyy,xxx | |||
| 6. Field containing line breaks (CRLF) and commas should be enclosed | 6. Field containing line breaks (CRLF), double quotes and commas | |||
| in double-quotes. For example: | should be enclosed in double-quotes. For example: | |||
| "aaa","b CRLF | "aaa","b CRLF | |||
| bb","ccc" CRLF | bb","ccc" CRLF | |||
| zzz,yyy,xxx | zzz,yyy,xxx | |||
| 7. If double-quotes are used to enclosed fields, then a double-quote | 7. If double-quotes are used to enclosed fields, then a double-quote | |||
| appearing inside a field must be escaped by preceding it with | appearing inside a field must be escaped by preceding it with | |||
| another double quote. For example: | another double quote. For example: | |||
| "aaa","b""bb","ccc" | "aaa","b""bb","ccc" | |||
| skipping to change at page 4, line 39 | skipping to change at page 4, line 43 | |||
| file = [header CRLF] record *(CRLF record) [CRLF] | file = [header CRLF] record *(CRLF record) [CRLF] | |||
| header = name *(COMMA name) | header = name *(COMMA name) | |||
| record = field *(COMMA field) | record = field *(COMMA field) | |||
| name = field | name = field | |||
| field = (escaped / non-escaped) | field = (escaped / non-escaped) | |||
| escaped = DQUOTE *(VCHAR / CR / LF / CRLF / 2*DQUOTE) DQUOTE | escaped = DQUOTE *(TEXTDATA / CR / LF / 2*DQUOTE) DQUOTE | |||
| non-escaped = *VCHAR | non-escaped = *TEXTDATA | |||
| COMMA = %x2C | COMMA = %x2C | |||
| CR = %x0D ;as per section 6.1 of RFC 2234 [2] | CR = %x0D ;as per section 6.1 of RFC 2234 [2] | |||
| DQUOTE = %x22;as per section 6.1 of RFC 2234 [2] | DQUOTE = %x22;as per section 6.1 of RFC 2234 [2] | |||
| LF = %x0A ;as per section 6.1 of RFC 2234 [2] | LF = %x0A ;as per section 6.1 of RFC 2234 [2] | |||
| CRLF = CR LF ;as per section 6.1 of RFC 2234 [2] | CRLF = CR LF ;as per section 6.1 of RFC 2234 [2] | |||
| VCHAR = %x21-7E ;as per section 6.1 of RFC 2234 [2] | TEXTDATA = %x20-21 / %x23-7E | |||
| 3. MIME Type Registration of text/csv | 3. MIME Type Registration of text/csv | |||
| This section provides the media-type registration application (as per | This section provides the media-type registration application (as per | |||
| RFC 2048 [1], which will be submitted to IANA after IESG approval of | RFC 2048 [1], which will be submitted to IANA after IESG approval of | |||
| this document. | this document. | |||
| To: ietf-types@iana.org | To: ietf-types@iana.org | |||
| Subject: Registration of MIME media type text/csv | Subject: Registration of MIME media type text/csv | |||
| MIME media type name: text | MIME media type name: text | |||
| MIME subtype name: csv | MIME subtype name: csv | |||
| Required parameters: none | Required parameters: none | |||
| Optional parameters: charset | Optional parameters: charset, header | |||
| Common usage of CSV is US-ASCII, but other character sets as | Common usage of CSV is US-ASCII, but other character sets as | |||
| defined by IANA for the "text" tree may be used. | defined by IANA for the "text" tree may be used in conjuction with | |||
| the "charset" parameter. | ||||
| The "header" parameter indicates the presence or absence of the | ||||
| header line. Valid values are "present" or "absent". | ||||
| Implementators choosing not to use this parameter must make their | ||||
| own decisions as to whether the header line is present or absent. | ||||
| Encoding considerations: | Encoding considerations: | |||
| As per section 4.1.1. of RFC 2046 [3], this media type uses CRLF | As per section 4.1.1. of RFC 2046 [3], this media type uses CRLF | |||
| to denote line breaks. However, implementors should be aware that | to denote line breaks. However, implementors should be aware that | |||
| some implementations may use other values. | some implementations may use other values. | |||
| Security considerations: | Security considerations: | |||
| CSV files contain passive text data which should not pose any | CSV files contain passive text data which should not pose any | |||
| skipping to change at page 5, line 49 | skipping to change at page 6, line 13 | |||
| data). | data). | |||
| Interoperability considerations: | Interoperability considerations: | |||
| Due to lack of a single specification there are considerable | Due to lack of a single specification there are considerable | |||
| differences among different implementations. Implementors should | differences among different implementations. Implementors should | |||
| "be conservative in what you do, be liberal in what you accept | "be conservative in what you do, be liberal in what you accept | |||
| from others" (RFC 793 [8]) when processing CSV files. An attempt | from others" (RFC 793 [8]) when processing CSV files. An attempt | |||
| at a common definition can be found in Section 2. | at a common definition can be found in Section 2. | |||
| Implementations deciding not to use the optional "header" | ||||
| parameter must make their own decision as to whether the header is | ||||
| absent or present. | ||||
| Published specification: | Published specification: | |||
| While numerous private specifications exist for various programs | While numerous private specifications exist for various programs | |||
| and systems, there is no single "master" specification for this | and systems, there is no single "master" specification for this | |||
| format. An attempt at a common definition can be found in | format. An attempt at a common definition can be found in | |||
| Section 2. | Section 2. | |||
| Applications which use this media type: | Applications which use this media type: | |||
| Spreadsheet programs and various data conversion utilities | Spreadsheet programs and various data conversion utilities | |||
| skipping to change at page 6, line 40 | skipping to change at page 7, line 8 | |||
| "text/csv" using the application provided in Section 3 of this | "text/csv" using the application provided in Section 3 of this | |||
| document. | document. | |||
| 5. Security Considerations | 5. Security Considerations | |||
| See discussion above | See discussion above | |||
| 6. Acknowledgments | 6. Acknowledgments | |||
| The author would like to thank Dave Crocker, Martin Duerst, Clyde | The author would like to thank Dave Crocker, Martin Duerst, Clyde | |||
| Ingram, Graham Klyne, Bruce Lilly and Chris Lilley for their helpful | Ingram, Graham Klyne, Bruce Lilly, Chris Lilley and members of the | |||
| suggestions. A special word of thanks to Dave for helping with the | IESG for their helpful suggestions. A special word of thanks to Dave | |||
| ABNF grammar. | for helping with the ABNF grammar. | |||
| The author would also like to thank Henrik Lefkowetz, Marshall Rose | ||||
| and the folks at xml.resource.org for providing many of the tools | ||||
| used for preparing RFCs and Internet drafts. | ||||
| 7. References | 7. References | |||
| 7.1 Normative References | 7.1 Normative References | |||
| [1] Freed, N., Klensin, J. and J. Postel, "Multipurpose Internet | [1] Freed, N., Klensin, J. and J. Postel, "Multipurpose Internet | |||
| Mail Extensions (MIME) Part Four: Registration Procedures", | Mail Extensions (MIME) Part Four: Registration Procedures", | |||
| BCP 13, RFC 2048, November 1996. | BCP 13, RFC 2048, November 1996. | |||
| [2] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax | [2] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax | |||
| skipping to change at page 8, line 8 | skipping to change at page 8, line 29 | |||
| which is also reachable via <ietf-types@iana.org>. Of course, | which is also reachable via <ietf-types@iana.org>. Of course, | |||
| comments directly to the author are always welcome. | comments directly to the author are always welcome. | |||
| A.2 Document Repository | A.2 Document Repository | |||
| Copies of this and earlier versions including multiple formats can be | Copies of this and earlier versions including multiple formats can be | |||
| found at <http://www.shaftek.org/publications/drafts/mime-csv/>. | found at <http://www.shaftek.org/publications/drafts/mime-csv/>. | |||
| A.3 Document History | A.3 Document History | |||
| Changes from draft-shafranovich-mime-csv-03 to | ||||
| draft-shafranovich-mime-csv-04: | ||||
| o Fixed ABNF grammar in response to IESG comments: VCHAR changed to | ||||
| TEXTDATA, DQUOTE excluded from TEXTDATA, spaces are included in | ||||
| TEXTDATA, CRLF taken out since CR and LF are already included. | ||||
| o Added clarification that double quotes may not be included inside | ||||
| non-quoted fields. | ||||
| o Added clarification that the same number of fields should appear | ||||
| in every line. | ||||
| o Added the optional "header" parameter to indicate the presence or | ||||
| absence of a header line. | ||||
| Changes from draft-shafranovich-mime-csv-02 to | Changes from draft-shafranovich-mime-csv-02 to | |||
| draft-shafranovich-mime-csv-03: | draft-shafranovich-mime-csv-03: | |||
| o Changed text to prohibit the last field ending with a comma | o Changed text to prohibit the last field ending with a comma | |||
| matching the ABNF grammar | matching the ABNF grammar | |||
| o The double quote escaping is now set to two double quotes instead | o The double quote escaping is now set to two double quotes instead | |||
| of three | of three | |||
| o Moved some of the references between informative and normative | o Moved some of the references between informative and normative | |||
| sections | sections | |||
| Changes from draft-shafranovich-mime-csv-01 to | Changes from draft-shafranovich-mime-csv-01 to | |||
| draft-shafranovich-mime-csv-02: | draft-shafranovich-mime-csv-02: | |||
| o Minor errors in ABNF grammar corrected in response to AD comments | o Minor errors in ABNF grammar corrected in response to AD comments | |||
| o Minor spelling mistakes corrected | o Minor spelling mistakes corrected | |||
| End of changes. | ||||
This html diff was produced by rfcdiff 1.23, available from http://www.levkowetz.com/ietf/tools/rfcdiff/ | ||||