forked from science-ation/science-ation
- Also quote a field if it contains a newline.
This commit is contained in:
parent
1b83ff4c12
commit
2af3482ecf
6
lcsv.php
6
lcsv.php
@ -75,8 +75,12 @@ class lcsv
|
|||||||
{
|
{
|
||||||
for($c=0;$c<$table_cols;$c++)
|
for($c=0;$c<$table_cols;$c++)
|
||||||
{
|
{
|
||||||
|
$quote = false;
|
||||||
//if the data contains the separator, we need to puti the data inside ""'s
|
//if the data contains the separator, we need to puti the data inside ""'s
|
||||||
if(strstr($dataline[$c],$this->separator()))
|
if(strstr($dataline[$c],$this->separator())) $quote = true;
|
||||||
|
/* If it contains a newline, also quote it */
|
||||||
|
if(strchr($dataline[$c], "\n")) $quote = true;
|
||||||
|
if($quote == true)
|
||||||
$this->csvdata.="\"".$dataline[$c]."\"";
|
$this->csvdata.="\"".$dataline[$c]."\"";
|
||||||
else
|
else
|
||||||
$this->csvdata.=$dataline[$c];
|
$this->csvdata.=$dataline[$c];
|
||||||
|
Loading…
Reference in New Issue
Block a user