Replies: 2 comments
-
It works when I set the |
Beta Was this translation helpful? Give feedback.
0 replies
-
For reference, you can override the use Maatwebsite\Excel\Concerns\WithCustomCsvSettings;
class MyImportFile extends ImportAction
{
// override the call method
public function call(array $parameters = []): mixed
{
// save the current import config so we can revert later
$cfg = config('excel.imports.csv');
// update the import config with this importer settings
config(['excel.imports.csv' => array_merge($cfg, $this->getCsvSettings())]);
// call the import process
$ret = parent::call($parameters);
// revert back to the default config
config(['excel.imports.csv' => $cfg]);
return $ret;
}
protected function getCsvSettings(): array
{
// for example:
return [
'input_encoding' => 'ISO-8859-15',
'delimiter' => ';',
];
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am importing csv files that are encoded in ISO-8859-15 which results in cryptic chars instead of umlauts (ä, ö, ü). Is there a way to set or even detect the expected encoding of a file? It all works fine when I convert the csv to utf-8 beforehand but that's a manual step I would like to avoid.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions