Import file without enclosure character #35
Description
I would like to import a text-file that uses only delimiter characters and no enclosure characters, like: value1;value2;value3 etc.
If I try to set the enclosure character to an emtpy string, false or null I get the following error:
"Warning: SplFileObject::setCsvControl(): enclosure must be a character in project/vendor/goodby/csv/src/Goodby/CSV/Impor\/Standard\/Lexer.php line 51
In order to make it work I've changed the the SplFileObject that is beeing used in the Lexer.php, namely $csv->setCsvControl($delimiter, $enclosure, $escape);
The PHP-documentation SplFileObject::setCsvControl lists three optional parameters: $delimiter, $enclosure and $escape www.php.net/manual/en/splfileobject.setcsvcontrol.php
The only way I have managed to parse a file without enclosures was to change $csv->setCsvControl($delimiter, $enclosure, $escape); to $csv->setCsvControl($delimiter);. This worked for me since I did not use the escape character anyway, but I was wondering if there was a better way to accomplish this.
Activity
LunarDevelopment commentedon Oct 7, 2015
👍
gooddaytoday commentedon May 5, 2016
PHP 5.3, I have similar error