I have a CSV file with some rows that has text/words that contain a special character like ñ
, what happened is that when I tried to import the file the words with characters above or alike will be converted to 0. Not sure if it is related to encoding, I found some solutions in the StackOverflow but none of them seem to work.
I am using the ToModel
use Maatwebsite\Excel\Concerns\ToModel;
To reproduce this, just try to put a special character in one of the cell of your CSV, then import it like:
Excel::import(new CsvImport, request()->file('file'));
The resulting inserted data that has a special character will be stored as 0
did any of you guys experience this one?
Yes me too @fmsthird
same here @fmsthird
Try setting the input encoding to the encoding that your file is in: https://github.com/Maatwebsite/Laravel-Excel/blob/3.1/config/excel.php#L76
The issue is the csv files are generated from a third part system i have no control over and came with charset=unknown-8bit so the encoding is not defined on the source file and to loop through every character the csv files contains hundreds of thousand rows which may time out before completion
Most helpful comment
did any of you guys experience this one?