Skip to content

Commit

Permalink
feat(STEUN-409): replace deprecated method utf8_encode with mb_conver…
Browse files Browse the repository at this point in the history
  • Loading branch information
wimvdputten committed May 30, 2023
1 parent 0e78511 commit f293a7d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"symfony/stopwatch": "^v6.2",
"bakame/psr7-csv-factory": "^1.0@dev",
"league/csv": "^9.1",
"monolog/monolog": "^2.8"
"monolog/monolog": "^2.8",
"ext-mbstring": "*"
},
"type": "magento2-module",
"autoload": {
Expand Down
7 changes: 6 additions & 1 deletion src/Streamer/FileCsv.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function getIterator()
$csvReader->setDelimiter($this->delimiter);
}
foreach ($csvReader->getIterator() as $row) {
yield (empty($this->headers) ? $row : \array_combine($this->headers, \array_map('utf8_encode', $row)));
yield (empty($this->headers) ? $row : \array_combine($this->headers, \array_map(self::class . '::mb_convert_encoding', $row)));
}
}

Expand All @@ -112,4 +112,9 @@ private function getRequestFile(): string
? $this->requestFile
: $this->directoryList->getRoot() . '/' . trim($this->requestFile, '/');
}

public function mb_convert_encoding($row)
{
return mb_convert_encoding($row, 'UTF-8', 'ISO-8859-1');
}
}

0 comments on commit f293a7d

Please sign in to comment.