CSV
A CSV (Comma-Separated Values) file is a plain text file format commonly used to store tabular data. Each line of the file represents a single row of data, and each value within a row is separated by a comma (,), hence the name "comma-separated values". However, other delimiters like semicolons (;) or tabs (\t) can also be used. CSV files are often used because they are easy to create and manipulate using text editors or spreadsheet software like Microsoft Excel or Google Sheets. They're widely used for importing and exporting data between different software applications and databases.
CSV files are sometimes referred to as TSV (Tab-Separated Values) or DSV (Delimiter-Separated Values) due to the different format variations in delimiters.
CSV Formats
LiteCart tries to support the most common variations of non-standard CSV formats but the default standard is the one preferred.
Type: CSV
Delimiter: ,
Encapsulator: "
Escape Character: "
Character Encoding: UTF-8 without Byte Order Mark (w/o BOM)
Line Endings: Windows CR+LF
CSV Formats In Applications
Application Format Delimiter Column Wrapper Escape character Encoding EOL LiteCart Compliant Comments
Google Docs Spreadsheet (Web application) CSV / TSV , or TAB " " Any CR / LF / CR+LF **Yes**
Microsoft Office Excel 2010 (numerals with decimal point) CSV (MS-Dos) , " " UTF-8 w/o BOM CR+LF No Excel 2011/Mac cannot correctly interpret a CSV file containing umlauts and diacritical marks no matter what encoding.
Microsoft Office Excel 2010 (numerals with decimal comma) DSV (MS-Dos) ; " " UTF-8 w/o BOM CR+LF No Excel 2011/Mac cannot correctly interpret a CSV file containing umlauts and diacritical marks no matter what encoding.
Microsoft Office Excel 2011 (numerals with decimal point) DSV (Mac) , " " Windows-1252, UTF-8 w/ BOM CR No Many regional versions of Excel will not be able to deal with Unicode in CSV.
Microsoft Office Excel 2011 (numerals with decimal comma) CSV (Mac) ; " " Windows-1252, UTF-8 w/ BOM CR No Many regional versions of Excel will not be able to deal with Unicode in CSV.
LibreOffice Calc (Multi platform) CSV / DSV / TSV Any " or ' " Any CR / LF / CR+LF **Yes** Supports all variations
w/ BOM = With Byte Order Mark
w/o BOM = Without Byte Order Mark
Encode CSV From Array
$csv = functions::csv_encode($array, $delimiter, $enclosure, $escape, $charset, $eol);
Decode CSV To Array
$array = functions::csv_decode($csv, $delimiter, $enclosure, $escape, $charset, $eol);