Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.9.3

Request #3588 Handle commas and doubel quotes in CSVs
Submitted: 2005-02-25 04:04 UTC
From: justinpatrin Assigned: dufuz
Status: Closed Package: Structures_DataGrid
PHP Version: Irrelevant OS: Irrelevant
Roadmaps: (Not assigned)    
Subscription  


 [2005-02-25 04:04 UTC] justinpatrin
Description: ------------ I've played around with MS Excel (yeah, I know, not the most reliable when it comes to standards) and it seems like commas and double quotes are handled thus: aaa,bbb,"cc,c",ddd,"ee""e" To support this, the output should be altered thus: if (strstr($text, '"')) { $text = '"'.str_replace('"', '""', $text).'"'; } elseif (strstr($text, ',')) { $text = '"'.$text.'"'; } Reproduce code: --------------- Ouput a CSV with a comma or double quote in the output Expected result: ---------------- Commas should stay in their field and double quotes should show up correctky Actual result: -------------- Commas in fields create an extra field when opening / processing the CSV file

Comments

 [2005-02-25 17:11 UTC] dufuz
I'll add that feature when I've time ... it will be something that will support the same as File_CSV ... will be it's own package, I might bundle it with SDG to start with I think, it's ready now I think so it might happen soon.
 [2005-03-11 23:03 UTC] asnagy
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better. I will implement Helgi's File_CSV implementation once it's ready. I added Justin's patch for now.
 [2005-03-13 01:53 UTC] dufuz
Actually it won't have anything to do with File_CSV :-) It's a package that doesn't have the file logic. At the moment Firman is giving my package as spin with the AddressBook package, haven't tho heard back from him in a while :-) Will probably do this after the Amsterdam conference in May.