Skip to main content Link Search Menu Expand Document (external link) Copy Copied

RFC-4180 rules

The CSVinterface library is intended to be nearest as possible to the RFC-4180 specs for CSV files, despite this some tweaks are added to make the interface more robust and useful.

In the table bellow all the rules of RFC-4180 specs and its counterparts on the CSVinterface.cls are listed. This topic is highly recommended for CSVinterface behavior knowledge.

RFC-4180 rule Over CSV interface
Each record is located on a separate line, delimited
by a linebreak (CRLF).
Accepts also CR or LF instead.
The last record in the file may or may not have an
ending line break.
In the same way. Includes a routine for avoid read
empty lines.
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.
In the same way. The presence or absence of the
header line should be indicated via the option
headersOmission.
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.
The class accepts CSV files with different numbers
of fields per record. The spaces betwen the
fields separator char and a single field is ignored
only if that field is enclosed in double quotes.
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
In the same way. The class accepts also the
apostrophe and tilde char for indicate fields needing to
be escaped. It's important to
notice that a single CSV record may have fields enclosed and
not enclosed by the escape char.
Fields containing line breaks (CRLF), double
quotes, and commas should be enclosed in double
quotes
In the same way. Also accepts Unix-style escape
by preceding the quote with a
backslash ("\"").
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.
In the same way. Also accepts Unix-style escape.