Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import file without enclosure character #35

Open
BillyTom opened this issue Mar 27, 2014 · 3 comments
Open

Import file without enclosure character #35

BillyTom opened this issue Mar 27, 2014 · 3 comments

Comments

@BillyTom
Copy link

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.

@LunarDevelopment
Copy link

👍

1 similar comment
@ghost
Copy link

ghost commented Jan 4, 2016

+1

@gooddaytoday
Copy link

PHP 5.3, I have similar error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants