Project

General

Profile

Actions

Bug #68127

closed

CsvUtility method csvToArray does not handle enclosures right

Added by Patrick Broens almost 9 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Must have
Category:
Fluid Styled Content
Target version:
Start date:
2015-07-14
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:

Description

When we have a csv string with enclosures, the first str_getcsv(), which is responsible for exploding the rows, strips off the enclosure of the first row. This is a bug in str_getcsv().

Imagine the next string

"Column A
And a newline", "Column B", "Column C" 
"Value", "Value2", "Value 3" 

after exploding the rows with str_getcsv(), the output will be

Column A
And a newline, "Column B", "Column C" 
Value, "Value2", "Value 3" 

The enclosure of the first columns (double quotes) is deleted.

When you have a comma in that cell, the cell will be splitted in two when passing the row string through str_getcsv()

The best solution seems to be to write the string to a temporary file and use fgetcsv().

Actions

Also available in: Atom PDF