Media type · text/csv
text/csv
text/csv is comma-separated values — a plain-text table with one record per line.
Key facts
| Type | text/csv |
|---|---|
| Extensions | .csv |
| Standard | RFC 4180; IANA registry |
| Text or binary | Text |
| Common parameter | charset=utf-8 |
What text/csv is
Each line is a record and commas separate fields. RFC 4180 describes the common conventions: fields containing commas, quotes or line breaks are wrapped in double quotes, and a double quote inside a quoted field is escaped by doubling it. The type is text, so character encoding matters.
Why imports go wrong
Excel in some locales expects a semicolon or a byte-order mark; a UTF-8 CSV without a BOM may show accented characters incorrectly. Values like 00123 lose leading zeros when a spreadsheet guesses they are numbers. Formula injection is a real risk: a cell starting with =, +, - or @ can execute when opened. Prefix such cells with an apostrophe or strip the leading character before export.
Frequently asked questions
Is text/csv always comma-separated?
No. The registered type describes the comma convention, but tab- and semicolon-separated files are common. Tell users which delimiter and encoding the file uses.
Why are accented characters broken in Excel?
Excel often assumes a locale encoding for CSV. Export as UTF-8 with a BOM, or import explicitly and choose UTF-8 in the import wizard.