[要約] RFC 4180は、コンマ区切り値(CSV)ファイルの共通フォーマットとMIMEタイプに関する仕様を定義しています。この文書では、CSVファイルの構造、フィールドの扱い、エンコーディングについての基準を提供し、"text/csv"というMIMEタイプを割り当てています。CSVファイルはデータの交換、データベースのインポート/エクスポート、表形式のデータの保存に広く利用されます。
Network Working Group Y. Shafranovich
Request for Comments: 4180 SolidMatrix Technologies, Inc.
Category: Informational October 2005
Common Format and MIME Type for Comma-Separated Values (CSV) Files
カンマ区切り値(CSV)ファイルの共通形式とMIMEタイプ
Status of This Memo
本文書の位置付け
This memo provides information for the Internet community. It does not specify an Internet standard of any kind. Distribution of this memo is unlimited.
このメモは、インターネットコミュニティに情報を提供します。いかなる種類のインターネット標準も指定しません。このメモの配布は無制限です。
Copyright Notice
著作権表示
Copyright (C) The Internet Society (2005).
Copyright(c)The Internet Society(2005)。
Abstract
概要
This RFC documents the format used for Comma-Separated Values (CSV) files and registers the associated MIME type "text/csv".
このRFCは、カンマ区切り値(CSV)ファイルに使用される形式を文書化し、関連するMIMEタイプ「text/csv」を登録します。
Table of Contents
目次
1. Introduction ....................................................2
2. Definition of the CSV Format ....................................2
3. MIME Type Registration of text/csv ..............................4
4. IANA Considerations .............................................5
5. Security Considerations .........................................5
6. Acknowledgments .................................................6
7. References ......................................................6
7.1. Normative References .......................................6
7.2. Informative References .....................................6
The comma separated values format (CSV) has been used for exchanging and converting data between various spreadsheet programs for quite 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 "text/tab-separated-values" type, no MIME types have ever been registered with IANA for CSV. At the same time, various programs and operating systems have begun to use different MIME types for this format. This RFC documents the format of comma separated values (CSV) files and formally registers the "text/csv" MIME type for CSV in accordance with RFC 2048 [1].
カンマ区切り値形式(CSV)は、かなり長い間、さまざまなスプレッドシートプログラム間でデータを交換および変換するために使用されてきました。驚くべきことに、この形式は非常に一般的ですが、正式に文書化されたことはありません。さらに、IANA MIME登録ツリーには「text/tab-separated-values」タイプの登録が含まれていますが、CSVのIANAに登録されたMIMEタイプはありません。同時に、さまざまなプログラムとオペレーティングシステムがこの形式に異なるMIMEタイプを使用し始めています。このRFCは、カンマ区切り値(CSV)ファイルの形式を文書化し、RFC 2048 [1]に従ってCSVの「text/csv」MIMEタイプを正式に登録します。
While there are various specifications and implementations for the CSV format (for ex. [4], [5], [6] and [7]), there is no formal specification in existence, which allows for a wide variety of interpretations of CSV files. This section documents the format that seems to be followed by most implementations:
CSV形式にはさまざまな仕様と実装がありますが(例:[4]、[5]、[6]、[7])、CSVファイルのさまざまな解釈を可能にする正式な仕様は存在しません。このセクションでは、ほとんどの実装が従っていると思われる形式を文書化します。
1. Each record is located on a separate line, delimited by a line break (CRLF). For example:
1. 各レコードは、改行(CRLF)で区切られた個別の行に配置されます。例えば:
aaa,bbb,ccc CRLF
zzz,yyy,xxx CRLF
2. The last record in the file may or may not have an ending line break. For example:
2. ファイルの最後のレコードには、末尾の改行がある場合とない場合があります。例えば:
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 should contain the same number of fields as the records in 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:
3. 通常のレコード行と同じ形式で、ファイルの最初の行としてオプションのヘッダー行が存在する場合があります。このヘッダーには、ファイル内のフィールドに対応する名前が含まれており、ファイルの残りのレコードと同じ数のフィールドを含める必要があります(ヘッダー行の有無は、このMIMEタイプのオプションの「header」パラメーターを介して示す必要があります)。例えば:
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, separated by commas. Each line should contain the same number of fields throughout the file. Spaces are considered part of a field and should not be ignored. The last field in the record must not be followed by a comma. For example:
4. ヘッダーと各レコード内には、カンマで区切られた1つ以上のフィールドがある場合があります。各行は、ファイル全体を通して同じ数のフィールドを含める必要があります。スペースはフィールドの一部と見なされ、無視されるべきではありません。レコードの最後のフィールドには、カンマが続いてはなりません。例えば:
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). If fields are not enclosed with double quotes, then double quotes may not appear inside the fields. For example:
5. 各フィールドは、二重引用符で囲まれている場合と囲まれていない場合があります(ただし、Microsoft Excelなどの一部のプログラムは、二重引用符をまったく使用しません)。フィールドが二重引用符で囲まれていない場合、フィールド内に二重引用符を含めることはできません。例えば:
"aaa","bbb","ccc" CRLF
zzz,yyy,xxx
6. Fields containing line breaks (CRLF), double quotes, and commas should be enclosed in double-quotes. For example:
6. 改行(CRLF)、二重引用符、およびカンマを含むフィールドは、二重引用符で囲む必要があります。例えば:
"aaa","b CRLF
bb","ccc" CRLF
zzz,yyy,xxx
7. If double-quotes are used to enclose fields, then a double-quote appearing inside a field must be escaped by preceding it with another double quote. For example:
7. 二重引用符を使用してフィールドを囲む場合、フィールド内に現れる二重引用符は、その前に別の二重引用符を付けてエスケープする必要があります。例えば:
"aaa","b""bb","ccc"
The ABNF grammar [2] appears as follows:
ABNF文法[2]は以下の通りです。
file = [header CRLF] record *(CRLF record) [CRLF]
header = name *(COMMA name)
record = field *(COMMA field)
name = field
field = (escaped / non-escaped)
escaped = DQUOTE *(TEXTDATA / COMMA / CR / LF / 2DQUOTE) DQUOTE
non-escaped = *TEXTDATA
COMMA = %x2C
CR = %x0D ;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]
CRLF = CR LF ;as per section 6.1 of RFC 2234 [2]
TEXTDATA = %x20-21 / %x23-2B / %x2D-7E
This section provides the media-type registration application (as per RFC 2048 [1].
このセクションでは、メディアタイプの登録申請を提供します(RFC 2048 [1]に従って)。
To: ietf-types@iana.org
宛先:ietf-types@iana.org
Subject: Registration of MIME media type text/csv
件名:Mime Media Type Text/CSVの登録
MIME media type name: text
MIMEメディアタイプ名:テキスト
MIME subtype name: csv
MIMEサブタイプ名:CSV
Required parameters: none
必要なパラメーター:なし
Optional parameters: charset, header
オプションのパラメーター:チャーセット、ヘッダー
Common usage of CSV is US-ASCII, but other character sets defined by IANA for the "text" tree may be used in conjunction with the "charset" parameter.
CSVの一般的な使用法はUS-ASCIIですが、「テキスト」ツリーのIANAによって定義された他の文字セットは、「charset」パラメーターと組み合わせて使用できます。
The "header" parameter indicates the presence or absence of the header line. Valid values are "present" or "absent". Implementors choosing not to use this parameter must make their own decisions as to whether the header line is present or absent.
「header」パラメータは、ヘッダー行の有無を示します。有効な値は "present" または "absent" です。このパラメータを使用しないことを選択した実装者は、ヘッダー行が存在するかどうかについて独自の決定を下す必要があります。
Encoding considerations:
エンコーディングに関する考慮事項:
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 some implementations may use other values.
RFC 2046 [3]のセクション4.1.1に従い、このメディアタイプは改行を示すためにCRLFを使用します。ただし、実装者は、一部の実装が他の値を使用する場合があることに注意する必要があります。
Security considerations:
セキュリティ上の考慮事項:
CSV files contain passive text data that should not pose any risks. However, it is possible in theory that malicious binary data may be included in order to exploit potential buffer overruns in the program processing CSV data. Additionally, private data may be shared via this format (which of course applies to any text data).
CSVファイルには、リスクをもたらすべきではないパッシブなテキストデータが含まれています。ただし、理論的には、CSVデータを処理するプログラムの潜在的なバッファーオーバーランを悪用するために、悪意のあるバイナリデータが含まれる可能性があります。さらに、プライベートデータはこの形式を介して共有される場合があります(もちろん、これは任意のテキストデータに適用されます)。
Interoperability considerations:
相互運用性の考慮事項:
Due to lack of a single specification, there are considerable differences among implementations. Implementors should "be conservative in what you do, be liberal in what you accept from others" (RFC 793 [8]) when processing CSV files. An attempt at a common definition can be found in Section 2.
単一の仕様がないため、実装にはかなりの違いがあります。実装者は、CSVファイルを処理する際に、「自身の行うことには保守的に、他人から受け入れるものには寛容に」(RFC 793 [8])あるべきです。共通定義の試みは、セクション2に記載されています。
Implementations deciding not to use the optional "header" parameter must make their own decision as to whether the header is absent or present.
オプションの "header" パラメータを使用しないことを決定した実装は、ヘッダーが存在するかどうかについて独自の決定を下す必要があります。
Published specification:
公開された仕様:
While numerous private specifications exist for various programs and systems, there is no single "master" specification for this format. An attempt at a common definition can be found in Section 2.
さまざまなプログラムやシステムには多数のプライベート仕様が存在しますが、この形式には単一の「マスター」仕様はありません。共通定義の試みは、セクション2に記載されています。
Applications that use this media type:
このメディアタイプを使用するアプリケーション:
Spreadsheet programs and various data conversion utilities
スプレッドシートプログラムとさまざまなデータ変換ユーティリティ
Additional information:
追加情報:
Magic number(s): none
マジックナンバー:なし
File extension(s): CSV
ファイル拡張子:csv
Macintosh File Type Code(s): TEXT
Macintoshファイルタイプコード:TEXT
Person & email address to contact for further information:
詳細情報の連絡先担当者およびメールアドレス:
Yakov Shafranovich <ietf@shaftek.org>
Intended usage: COMMON
意図された使用法:COMMON
Author/Change controller: IESG
著者/変更コントローラー:IESG
The IANA has registered the MIME type "text/csv" using the application provided in Section 3 of this document.
IANAは、このドキュメントのセクション3に記載されている申請を使用して、MIMEタイプ「text/csv」を登録しました。
See discussion above in section 3.
セクション3の上記の説明を参照してください。
The author would like to thank Dave Crocker, Martin Duerst, Joel M. Halpern, Clyde Ingram, Graham Klyne, Bruce Lilly, Chris Lilley, and members of the IESG for their helpful suggestions. A special word of thanks goes to Dave for helping with the ABNF grammar.
著者は、Dave Crocker、Martin Duerst、Joel M. Halpern、Clyde Ingram、Graham Klyne、Bruce Lilly、Chris Lilley、およびIESGのメンバーの有益な提案に感謝します。ABNF文法を手伝ってくれたDaveに特に感謝します。
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.
著者はまた、RFCとインターネットドラフトの準備に使用される多くのツールを提供してくれたHenrik Lefkowetz、Marshall Rose、およびxml.resource.orgの人々に感謝したいと思います。
A special thank you goes to L.T.S.
L.T.S.に特に感謝します。
[1] Freed, N., Klensin, J., and J. Postel, "Multipurpose Internet Mail Extensions (MIME) Part Four: Registration Procedures", BCP 13, RFC 2048, November 1996.
[1] Freed, N., Klensin, J., およびJ. Postel, 「多目的インターネットメール拡張機能(MIME)パート4:登録手順」, BCP 13, RFC 2048, 1996年11月.
[2] Crocker, D. and P. Overell, "Augmented BNF for Syntax Specifications: ABNF", RFC 2234, November 1997.
[2] Crocker, D.およびP. Overell, 「構文仕様のための拡張BNF:ABNF」, RFC 2234, 1997年11月.
[3] Freed, N. and N. Borenstein, "Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types", RFC 2046, November 1996.
[3] Freed, N.およびN. Borenstein, 「多目的インターネットメール拡張機能(MIME)パート2:メディアタイプ」, RFC 2046, 1996年11月.
[4] Repici, J., "HOW-TO: The Comma Separated Value (CSV) File Format", 2004, <http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm>.
[4] Repici, J., 「HOW-TO:カンマ区切り値(CSV)ファイル形式」, 2004, <http://www.creativyst.com/doc/articles/csv/csv01.htm>.
[5] Edoceo, Inc., "CSV Standard File Format", 2004, <http://www.edoceo.com/utilis/csv-file-format.php>.
[5] Edoceo, Inc., 「CSV Standard File Format」, 2004, <http://www.edoceo.com/utilis/csv-file-format.php>.
[6] Rodger, R. and O. Shanaghy, "Documentation for Ricebridge CSV Manager", February 2005, <http://www.ricebridge.com/products/csvman/reference.htm>.
[6] Rodger, R.and O. Shanaghy, 「Ricebridge CSV Managerのドキュメント」, 2005年2月, <http://www.ricebridge.com/products/csvman/reference.htm>.
[7] Raymond, E., "The Art of Unix Programming, Chapter 5", September 2003, <http://www.catb.org/~esr/writings/taoup/html/ch05s02.html>.
[7] Raymond, E., 「The Art of Unix Programming, 第5章」, 2003年9月, <http://www.catb.org/~esr/writings/taoup/html/ch05s02.html>.
[8] Postel, J., "Transmission Control Protocol", STD 7, RFC 793, September 1981.
[8] Postel, J., 「伝送制御プロトコル」, STD 7, RFC 793, 1981年9月.
Author's Address
著者の連絡先
Yakov Shafranovich SolidMatrix Technologies, Inc.
Yakov Shafranovich SolidMatrix Technologies, Inc.
EMail: ietf@shaftek.org
URI: http://www.shaftek.org
Full Copyright Statement
完全な著作権声明
Copyright (C) The Internet Society (2005).
Copyright(c)The Internet Society(2005)。
This document is subject to the rights, licenses and restrictions contained in BCP 78, and except as set forth therein, the authors retain all their rights.
この文書は、BCP 78に含まれる権利、ライセンス、および制限の対象となり、そこに記載されている場合を除き、著者はすべての権利を保持しています。
This document and the information contained herein are provided on an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
このドキュメントとここに含まれる情報は、「現状のまま」に基づいて提供されています。また、貢献者、彼/彼女が代表する組織、または彼/彼女を後援する組織(もしあれば)、インターネット協会とインターネットエンジニアリングタスクフォースは、ここでの情報の使用が権利を侵害しないという保証や、商品性または特定の目的への適合性の黙示的な保証を含むがこれらに限定されない、明示的または黙示的なすべての保証を否認します。
Intellectual Property
知的財産
The IETF takes no position regarding the validity or scope of any Intellectual Property Rights or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; nor does it represent that it has made any independent effort to identify any such rights. Information on the procedures with respect to rights in RFC documents can be found in BCP 78 and BCP 79.
IETFは、知的財産権またはその他の権利の有効性または範囲に関して、本書に記載されている技術の実装または使用に関連すると主張される可能性のある他の権利、またはそのような権利に基づくライセンスがどの程度利用可能になるかについては、立場をとりません。また、そのような権利を特定するために独立した努力をしたことも表明していません。RFCドキュメントの権利に関する手順に関する情報は、BCP 78およびBCP 79に記載されています。
Copies of IPR disclosures made to the IETF Secretariat and any assurances of licenses to be made available, or the result of an attempt made to obtain a general license or permission for the use of such proprietary rights by implementers or users of this specification can be obtained from the IETF on-line IPR repository at http://www.ietf.org/ipr.
IETF事務局に行われたIPR開示のコピー、利用可能になるライセンスの保証、またはこの仕様の実装者またはユーザーによるそのような所有権の使用のための一般的なライセンスまたは許可を取得するための試みの結果は、http://www.ietf.org/iprのIETFオンラインIPRリポジトリから取得できます。
The IETF invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights that may cover technology that may be required to implement this standard. Please address the information to the IETF at ietf-ipr@ietf.org.
IETFは、関心のある当事者に、著作権、特許、または特許出願、またはこの標準を実装するために必要な技術をカバーする可能性のあるその他の所有権について注意を喚起するよう招待します。ietf-ipr@ietf.orgのIETFへ情報を通知してください。
Acknowledgement
謝辞
Funding for the RFC Editor function is currently provided by the Internet Society.
RFCエディター機能の資金は現在、インターネット協会によって提供されています。