CSV Export and comma separated values
-
Hello all,
If I log a value with commas in it the CSV export breaks due to a lack of field escaping.
aal_insert_log( array( 'action' => 'Test Log', 'object_type' => 'Options', 'object_name' => 'thing,with,comma', // This is the problem 'object_subtype' => 'Test Log' ));
using version 2.7.0
I’d like to report this as a bug with the following code thank you
$output = join( ',', array_values( $columns ) ) . "\n"; foreach ( $data as $row ) { $output .= join( ',', $row ) . "\n"; }
This export could be refactored into perhaps?
$fp = fopen('php://output', 'wb'); fputcsv($fp, $columns ); foreach ( $data as $row ) { fputcsv($fp, $row ); } fclose($fp);
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘CSV Export and comma separated values’ is closed to new replies.