mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 04:29:28 +01:00
Fix order, escape quotes first or the field delimiters get doubled
This commit is contained in:
parent
855c601f98
commit
726798c8cb
@ -1172,11 +1172,14 @@ class nextmatch_widget
|
|||||||
}
|
}
|
||||||
$value = implode(', ',$value);
|
$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)
|
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).'"';
|
||||||
// to avoid early linebreak by Excel, escape double quotes in text
|
$value = str_replace("\r\n", "\n", $value); // to avoid early linebreak by Excel
|
||||||
$value = str_replace(array("\r\n", '"'), array("\n",'""'), $value);
|
|
||||||
}
|
}
|
||||||
$out[] = $value;
|
$out[] = $value;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user