-
-
Notifications
You must be signed in to change notification settings - Fork 338
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
Enclosure should be remove when stripping BOM sequence #102
Comments
The enclosure character should also be stripped when The BOM character is removed to properly output CSV content
@onema thanks for reporting the bug. A patch was made available on the master branch. After review and testing a patch release will be made next week. In the meantime you can test that the dev-master branch fix works for you |
Awesome! will update and be testing it today. |
I just tested the master branch and $csv = '"Paret name","Child name","Title"
"parent 1","child 1","title"
"parent 2","child 2","title"
';
$csvReader = Reader::createFromString($csv);
$csvReader->stripBom(true);
$assoc = $csvReader->fetchAssoc();
$all = $csvReader->fetchAll();
|
Quoting the docs you are referring to:
This includes the I know it may seems strange but this is a trade-off I choose when implementing the solution. Stripping BOM sequence is only useful when the first cell of the first row is expected in the result set. In all others situations you don't want to add another layer of Iterator when it is not needed. |
👍 thank you for your work on this. |
The patch release 7.1.2 is released with the bug fix |
I have the following code:
And the associative array returned by
fetchAssoc
looks like this:Where
parent name
contains the quotes"
. At fist, I thought there was something wrong with thefetchAssoc
method but after close inspection I realized that the file I was getting the CSV from wasUTF-8
with BOM. Then I try to setstripBom
totrue
, but it didn't work as I was still getting the same output.The only way for me to get it to work was to manually strip the BOM before creating the reader:
stripBom
is set to true?The text was updated successfully, but these errors were encountered: