Skip to content

Commit 137ea35

Browse files
author
Phil Sturgeon
committed
Merge pull request chriskacerguis#228 from justinethier/master
When outputting CSV escape double quotes per RFC 4180
2 parents 22a6c75 + b0cf0b4 commit 137ea35

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

application/libraries/Format.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ public function to_csv()
200200
$output = implode(',', $headings).PHP_EOL;
201201
foreach ($data as &$row)
202202
{
203+
$row = str_replace('"', '""', $row); // Escape dbl quotes per RFC 4180
203204
$output .= '"'.implode('","', $row).'"'.PHP_EOL;
204205
}
205206

0 commit comments

Comments
 (0)