From b6a22cc764d730227d3bc36c98d86daf47ccb772 Mon Sep 17 00:00:00 2001 From: mohab Date: Mon, 27 May 2013 23:08:12 +0200 Subject: [PATCH] Escaping CSV Headings to fix the case of a heading including a comma --- application/libraries/Format.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/libraries/Format.php b/application/libraries/Format.php index acb13699..1bcb4aa4 100644 --- a/application/libraries/Format.php +++ b/application/libraries/Format.php @@ -197,7 +197,7 @@ public function to_csv() $data = array($data); } - $output = implode(',', $headings).PHP_EOL; + $output = '"'.implode('","', $headings).'"'.PHP_EOL; foreach ($data as &$row) { $output .= '"'.implode('","', $row).'"'.PHP_EOL;