【CSV Format】
The comma separated values format (CSV) has been used for exchanging and converting data between various spreadsheet programs for quite some time. 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. Each record is located on a separate line, delimited by a line break (CRLF). For example:
以CRLF来区别每一个record
2. The last record in the file may or may not have an ending line break. For example:
最后一条记录可以不加CRLF
3. There maybe an optional header line appearing as the first lineof 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:
可以添加head,通过optional parameter的header flag来指示
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:
用逗号分隔
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:
可以有也可以没有双引号
6. Fields containing line breaks (CRLF), double quotes, and commas should be enclosed in double-quotes. For example:
如果有CRLF, 双引号,逗号,则这些符号必须放置在双引号中。
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:
使用双引号时,必须前置双引号以escape
参考:http://www.rfc-editor.org/rfc/rfc4180.txt