@@ -49,19 +49,23 @@ class RowIterator implements IteratorInterface
4949 /** @var string End of line delimiter, encoded using the same encoding as the CSV */
5050 protected $ encodedEOLDelimiter ;
5151
52+ /** @var string End of line delimiter, given by the user as input. */
53+ protected $ inputEOLDelimiter ;
54+
5255 /**
5356 * @param resource $filePointer Pointer to the CSV file to read
5457 * @param string $fieldDelimiter Character that delimits fields
5558 * @param string $fieldEnclosure Character that enclose fields
5659 * @param string $encoding Encoding of the CSV file to be read
5760 * @param \Box\Spout\Common\Helper\GlobalFunctionsHelper $globalFunctionsHelper
5861 */
59- public function __construct ($ filePointer , $ fieldDelimiter , $ fieldEnclosure , $ encoding , $ globalFunctionsHelper )
62+ public function __construct ($ filePointer , $ fieldDelimiter , $ fieldEnclosure , $ encoding , $ endOfLineDelimiter , $ globalFunctionsHelper )
6063 {
6164 $ this ->filePointer = $ filePointer ;
6265 $ this ->fieldDelimiter = $ fieldDelimiter ;
6366 $ this ->fieldEnclosure = $ fieldEnclosure ;
6467 $ this ->encoding = $ encoding ;
68+ $ this ->inputEOLDelimiter = $ endOfLineDelimiter ;
6569 $ this ->globalFunctionsHelper = $ globalFunctionsHelper ;
6670
6771 $ this ->encodingHelper = new EncodingHelper ($ globalFunctionsHelper );
@@ -172,7 +176,7 @@ protected function getNextUTF8EncodedLine()
172176 protected function getEncodedEOLDelimiter ()
173177 {
174178 if (!isset ($ this ->encodedEOLDelimiter )) {
175- $ this ->encodedEOLDelimiter = $ this ->encodingHelper ->attemptConversionFromUTF8 ("\n" , $ this ->encoding );
179+ $ this ->encodedEOLDelimiter = $ this ->encodingHelper ->attemptConversionFromUTF8 ($ this -> inputEOLDelimiter , $ this ->encoding );
176180 }
177181
178182 return $ this ->encodedEOLDelimiter ;
0 commit comments