RFC4180 defines a common Format and MIME Type for Comma-Separated Values (CSV) Files.
Questions tagged [rfc4180]
13 questions
27
votes
1 answer
Is there a library that can write an RFC 4180 CSV file with PHP?
I am aware of fputcsv, but according to this "wontfix" bug fputcsv does not correctly escape input, and its behavior will not be fixed for compatibility reasons. I would prefer an implementation that is compliant with RFC 4180 so Excel and…

AlexMax
- 1,204
- 14
- 36
17
votes
1 answer
Proper syntax for optional header parameter for text/csv mimetype?
According to RFC 4180:
...the presence or absence of the header line
should be indicated via the optional "header" parameter of this
MIME type...
So, does that mean the correct string is:
text/csv; header
Or perhaps:
text/csv; header=true
Or…

i_am_jorf
- 53,608
- 15
- 131
- 222
15
votes
1 answer
LOAD DATA from CSV file where doublequote was used as the escape character
I have a bunch of CSV data that I need to load into a MySQL database. Well, CSV-ish, perhaps. (edit: actually, it looks like the stuff described in RFC 4180)
Each row is a list of comma-separated doublequoted strings. To escape any doublequotes…

rampion
- 87,131
- 49
- 199
- 315
2
votes
1 answer
Write RFC4180 compatible flat files with less agressive quoting
When using write.table or write.csv in R, double quotes are added around all non-numeric fields by default regardless of whether the quotes are actually required for proper parsing of the csv file.
Take a Python script as an example:
import…

Timothy C. Quinn
- 3,739
- 1
- 35
- 47
2
votes
1 answer
VBScript processing CSV (RFC4180)
What I'm attempting to do is read over a RFC4180 compliant csv file, and throw each value into an array, for processing further on down the script. Below is the most convoluted but compliant csv line I could come up with, and it works, but this…

LukeP
- 21
- 2
2
votes
2 answers
SPSS Syntax to import RFC 4180 CSV file with escaped double quotes
How do I read an RFC4180-standard CSV file into SPSS? Specifically, how to handle string values that have embedded double quotes which are (properly) escaped with a second double quote?
Here's one instance of a record with a problematic…

prototype
- 7,249
- 15
- 60
- 94
1
vote
1 answer
To validate CSV files according to RFC 4180, is the rule "The last field in the record must not be followed by a comma." wrong?
RFC 4180 states in page 2 that:
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…

CanisLupus
- 583
- 5
- 15
1
vote
1 answer
Need regex help to clean up delimited data
I've got some pipe-delimited data that looks like this:
field|field|field|field|another "field"|field
field|field|field|"another" field|field|field
field|"fie|ld"|field|field|field|field
And the problem that I'm having is that the…

user1399233
- 73
- 1
- 8
0
votes
1 answer
How and where do you encode the header and charset parameters for CSV files?
The CSV spec (RFC 4180) identifies header and charset parameters, but it strangely doesn't specify where they go, or how they're encoded. For header it says:
The "header" parameter indicates the presence or absence of the header
line. Valid values…

LearningFast
- 1,163
- 13
- 13
0
votes
1 answer
Java CSV: Read/Write CSV with multiple header lines
I'm a noob in CSV processing using Java.
How can I read/write multiple header CSV in Java. For example:
Data in hand after multiple joins (say from a table).
-------------------------------------------------------------
|student_id | name | year |…

Jake
- 391
- 1
- 4
- 22
0
votes
0 answers
Python Pandas - CSV Import RFC 4180
I've a short question about the csv module of pandas. Is the format standardized (RFC 4180)? Perhaps based on the Lib/csv.py module? Is this documented (source)?

Crimson
- 1
0
votes
1 answer
OpenCSV does not comply CSV standard (RFC 4180)
I use openCSV to parse CSV file (separator is ';' & quote character is '"'), when parsing a wrong format likes below row:
column1;"column2";column""3
The result is an array of values:
a[0] = column1, a[1] = column2, a[2] = column"3
But I think…

nguyenbkcse
- 549
- 1
- 10
- 20
0
votes
1 answer
CSV standard regarding end of a row
I am writing a CSV parser and I want it to comply with this standards. It states:
Each record is located on a separate line, delimited by a line break (CRLF)
How should I handle rows ending with only CR of LF character? Should I treat them as…

PKua
- 463
- 3
- 15