I've adjusted the write-modes in save($file, $data, $append, $fields) to be
'ab' and 'wb' instead of 'at' and 'wt'. The reason behind this change is that
PHP, with the mode of t, will replace \n with \r\n on Windows. We are already
appending \r\n to the end of our lines, in unparse(), however. Unfortunately,
this means that our line endings go from \r\n to \r\r\n on Windows, resulting
in an additional line. Changing $linefeed to \n does not solve the problem. The
php docs for fopen() also suggest using binary mode for portability across
platforms.
I have tested this fix with PHP 5.4.9 on OS X (10.7.5), Fedora (12), and on
Windows 8, and the outputted CSV files are valid, with the correct number of
lines.
Original issue reported on code.google.com by kolnst...@gmail.com on 27 Dec 2012 at 6:49
Original issue reported on code.google.com by
kolnst...@gmail.com
on 27 Dec 2012 at 6:49Attachments: