From b0283ee305150672b9bbafd4317ec38aa794bdc6 Mon Sep 17 00:00:00 2001 From: Ignace Nyamagana Butera Date: Wed, 21 Jan 2015 12:57:26 +0100 Subject: [PATCH] improve factory methods --- src/AbstractCsv.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/AbstractCsv.php b/src/AbstractCsv.php index 74a13eca..5b332bf0 100644 --- a/src/AbstractCsv.php +++ b/src/AbstractCsv.php @@ -224,7 +224,7 @@ public static function createFromString($str) ); } $obj = new SplTempFileObject(); - $obj->fwrite((string) $str.PHP_EOL); + $obj->fwrite(rtrim($str)."\n"); return static::createFromFileObject($obj); } @@ -242,8 +242,9 @@ protected function newInstance($class_name, $open_mode) $csv = new $class_name($this->path, $open_mode); $csv->delimiter = $this->delimiter; $csv->enclosure = $this->enclosure; - $csv->escape = $this->escape; + $csv->escape = $this->escape; $csv->encodingFrom = $this->encodingFrom; + $csv->bom = $this->bom; return $csv; }