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

CSV field enclosure #123

Open
dtrdewaele opened this issue Jul 30, 2012 · 4 comments
Open

CSV field enclosure #123

dtrdewaele opened this issue Jul 30, 2012 · 4 comments

Comments

@dtrdewaele
Copy link

To create a package with a CSV file you have the delimiter parameter, but you don't have a field enclosure. We have a lot of CSV files like this

field1;field2;"item1,item2,item3";field3...

We get error with this files because the delimiter is set to ; and so the item1,item2 will be split also. This results in an error message that we have to much data columns than header columns...

Regards

@dtrdewaele
Copy link
Author

Hmm sorry... TDT does something with enclosers, but it doesn't work :) I'll see what I can do

@coreation
Copy link
Member

Ah I see, think I know where the problem is, we used to ignore the enclosure problem because we used a function which by default took a " as an enclosure character. However, we changed the read function a little bit, could be that this function was replaced. Maybe add a " to the read function on line 97 in CSV, fgetcsv has an optional parameter for enclosures. Note that we didnt have an enclosure parameter because according to the CSV "standard" (Yes, I know there really isnt one ) there was only one enclosure character ", which was thus by default included in our php getCSV function. I'll try out as well tomorrow!

@coreation
Copy link
Member

Hmm, if I use this tiny CSV file for a test:

"Postnr","Lokaliteit,endinges","Zonenr","Zonenaam"
"1000","BRUSSEL 1","10","Brussels Hoofdstedelijk Gewest"
"1020","BRUSSEL 2","10","Brussels Hoofdstedelijk Gewest,,"

Which has several delimiters in enclosures ( double quotes, see RFC for CSV http://www.ietf.org/rfc/rfc4180.txt ), and works fine here. Any updates from your side ?

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

2 participants