Fix escaping of double quotes

This commit is contained in:
Nathan Gray 2011-01-24 16:46:59 +00:00
parent f595a3f334
commit 5379529398

View File

@ -1172,13 +1172,9 @@ class nextmatch_widget
}
$value = implode(', ',$value);
if (strpos($value,'"') !== false)
{
$value = '"'.str_replace('"', '""', $value).'"'; // Escape double quotes
}
if (strpos($value,$separator) !== false || strpos($value,"\n") !== false || strpos($value,"\r") !== false)
{
$value = '"'.str_replace(array('\\','"'),array('\\\\','\\"'),$value).'"';
$value = '"'.str_replace(array('\\', '"',),array('\\\\','""'),$value).'"';
$value = str_replace("\r\n", "\n", $value); // to avoid early linebreak by Excel
}
$out[] = $value;