Fix escaping of double quotes

This commit is contained in:
Nathan Gray 2011-01-24 16:43:15 +00:00
parent b6b7e7bd84
commit 939052437d

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;