Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HELP! Special Characters like ñ will convert a word into number 0 on import #2572

Closed
2 tasks done
fmsthird opened this issue Feb 29, 2020 · 6 comments
Closed
2 tasks done
Labels

Comments

@fmsthird
Copy link

fmsthird commented Feb 29, 2020

Prerequisites

Versions

  • PHP version: 7.2
  • Laravel version: 5.8
  • Package version: ^3.1

Description

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.

Additional Information

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

@fmsthird
Copy link
Author

fmsthird commented Mar 4, 2020

did any of you guys experience this one?

@fmsthird fmsthird changed the title [QUESTION] Special Characters like ñ will convert a word into number 0 on import HELP! Special Characters like ñ will convert a word into number 0 on import Mar 6, 2020
@ckmirafss
Copy link

ckmirafss commented Mar 30, 2020

Yes me too @fmsthird

@tmoswa
Copy link

tmoswa commented Apr 28, 2020

same here @fmsthird

@patrickbrouwers
Copy link
Member

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

@tmoswa
Copy link

tmoswa commented Apr 29, 2020

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

@Davidsr
Copy link

Davidsr commented Feb 25, 2022

Same here @fmsthird

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants