fuel/core — Issue #766: Bug on format class: CSV not being parsed properly
Author: blitux
Created: 2012-01-06 22:41:23+00:00
State: open

Hi there,

I was using the format class for importing CSV files. There's an issue when there are empty values at the end of the line like on this example:

```
"value1", "", "value2",""
```

On file core/classes/format.php line 402, original code is:

```php
$data_fields = explode('","', trim($row, '"'));
```

I solved the issue replacing the line with this code:

```php
$data_fields = explode(',', str_replace('"','',trim($row)));
```

Maybe there's a better way to solve this problem. Is this really a bug or I am missinterpreting the way CSV files should work?

Also, there's no way to define value separator (semicolon, comma, etc), and end of line (unix or dos way), but that's another story.

Thanks.