CSV

Título

OldNew
1Csv Formats1CSV

Permalink

OldNew
1csv_formats1csv

Conteúdo

OldNew
1# CSV Formats1# CSV
22
3LiteCart tries to support the most common variations of non-standard CSV3A 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.
4formats but one is prefered.4
55CSV files are sometimes referred to as TSV (Tab-Separated Values) or DSV (Delimiter-Separated Values) due to the different format variations in delimiters.
6\^ Format \^ Delimiter \^ Column Wrapper \^ Escape character \^ Encoding6
7\^ EOL | CSV | , | " | " | UTF-8 w/o BOM | CR+LF7## CSV Formats
88
9A list of CSV formats supported by applications.9LiteCart tries to support the most common variations of non-standard CSV formats but the default standard is the one preferred.
1010
11\^ Application \^ Format \^ Delimiter \^ Column Wrapper \^ Escape11```txt
12character \^ Encoding \^ EOL \^ Recommended \^ Comments | Google Docs12Type: CSV
13Spreadsheet (Web application) | CSV / TSV | , or TAB | " | " |13Delimiter: ,
14Any | CR / LF / CR+LF | **Yes** | | Microsoft Office Excel 201014Encapsulator: "
15(numerals with decimal point) | CSV (MS-Dos) | , | " | " | UTF-815Escape Character: "
16w/o BOM | CR+LF | No | Excel 2011/Mac cannot correctly interpret a16Character Encoding: UTF-8 without Byte Order Mark (w/o BOM)
17CSV file containing umlauts and diacritical marks no matter what17Line Endings: Windows CR+LF
18encoding. | Microsoft Office Excel 2010 (numerals with decimal comma)18```
19| DSV (MS-Dos) | ; | " | " | UTF-8 w/o BOM | CR+LF | No |19
20Excel 2011/Mac cannot correctly interpret a CSV file containing umlauts20### CSV Formats In Applications
21and diacritical marks no matter what encoding. | Microsoft Office Excel21
222011 (numerals with decimal point) | DSV (Mac) | , | " | " |22```txt
23Windows-1252, UTF-8 w/ BOM | CR | No | Many regional versions of23Application Format Delimiter Column Wrapper Escape character Encoding EOL LiteCart Compliant Comments
24Excel will not be able to deal with Unicode in CSV. | Microsoft Office24Google Docs Spreadsheet (Web application) CSV / TSV , or TAB " " Any CR / LF / CR+LF **Yes**
25Excel 2011 (numerals with decimal comma) | CSV (Mac) | ; | " | "25Microsoft 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.
26| Windows-1252, UTF-8 w/ BOM | CR | No | Many regional versions of26Microsoft 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.
27Excel will not be able to deal with Unicode in CSV. | LibreOffice Calc27Microsoft 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.
28(Multi platform) | CSV / DSV / TSV | Any | " or ' | " | Any |28Microsoft 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.
29CR / LF / CR+LF | **Yes** | Supports all variations29LibreOffice Calc (Multi platform) CSV / DSV / TSV Any " or ' " Any CR / LF / CR+LF **Yes** Supports all variations
3030```
31w/ BOM = With Byte Order Mark31
3232*w/ BOM* = With Byte Order Mark
33w/o BOM = Without Byte Order Mark33
34*w/o BOM* = Without Byte Order Mark
35
36## Encode CSV From Array
37
38```php
39$csv = functions::csv_encode($array, $delimiter, $enclosure, $escape, $charset, $eol);
40```
41
42## Decode CSV To Array
43```php
44$array = functions::csv_decode($csv, $delimiter, $enclosure, $escape, $charset, $eol);
45```
46
47Note that the parameters $delimiter, $enclosure, $escape, $charset, $eol are optional. If omitted they will default to the values of the standard first mentioned in this article.

Edited by tim on 23 abr 2024 at 19:24

This website uses no cookies and no third party tracking technology. We think we can do better than others and really think about your privacy.