diff --git a/src/Csv.php b/src/Csv.php index 0a656cb..0a1fb2e 100644 --- a/src/Csv.php +++ b/src/Csv.php @@ -355,12 +355,13 @@ public static function serializeRow(array $value, array $omit = [], $delimiter = $rowAry = []; foreach ($value as $key => $val) { if (!in_array($key, $omit)) { - $val = str_replace(["\n", "\r"], [" ", " "], $val); if (strpos($val, $delimiter) !== false) { if (strpos($val, $enclosure) !== false) { $val = str_replace($enclosure, $escape . $enclosure, $val); } $val = $enclosure . $val . $enclosure; + } else if (strpos($val, "\n") !== false) { + $val = $enclosure . $val . $enclosure; } $rowAry[] = $val; }