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 export: cse fputcsv instead of custom $escape and $print #273

Open
lucien144 opened this issue Apr 26, 2016 · 3 comments
Open

CSV export: cse fputcsv instead of custom $escape and $print #273

lucien144 opened this issue Apr 26, 2016 · 3 comments

Comments

@lucien144
Copy link

How about using fputcsv instead of custom escaping and custom print?

        $print = function(array $row) {
            $out = fopen('php://output', 'w');
            fputcsv($out, $row, ";");
            fclose($out);
        };
@o5
Copy link
Owner

o5 commented Apr 26, 2016

Can you explain your troubles with Export?

@lucien144
Copy link
Author

When I was exporting ~25MB CSV, the CSV was malformatted and could not be opened. Another issue was that $escape wraps empty cells to "" which eg. Numbers on OS X displays as a column with "".

When I created my own Export with fputcsv all worked.

In other words, PHP's fputcsv seems to do a better job that your custom $escape and $print, it also seems to be faster and the code is smaller.

It's just a suggestion :)

@o5
Copy link
Owner

o5 commented Apr 26, 2016

I already used fputcsv() in export. I don't remember why this method is not used, but referenced commit resolved marked issues (from commit msg).

I'll really appreciate pull request with your changes in export class and also in test-cases (there should be test data which does not work with current export)

@o5 o5 added the DISCUSSION label May 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants