Skip to content

Commit 91d10a9

Browse files
committed
Can set input encoding when reading csv files
1 parent a554eb0 commit 91d10a9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Maatwebsite/Excel/Excel.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,10 @@ public function load($file, $firstRowAsLabel = false, $inputEncoding = 'UTF-8')
117117
$this->format = \PHPExcel_IOFactory::identify($this->file);
118118

119119
// Init the reader
120-
$this->reader = \PHPExcel_IOFactory::createReader($this->format)->setInputEncoding($inputEncoding);
120+
$this->reader = \PHPExcel_IOFactory::createReader($this->format);
121+
122+
if ($this->format === 'CSV')
123+
$this->reader->setInputEncoding($inputEncoding);
121124

122125
// Set default delimiter
123126
//$this->reader->setDelimiter($this->delimiter);

0 commit comments

Comments
 (0)