Reference URL:
https://stackoverflow.com/questions/42328597/opencsv-populating-first-column-as-null
3
I met the same problem.
Solution
I saved the csv file again by utf-8 without BOM.
Then the first column is set with correct value.
No code needs to be changed.
I use the text editor named sakura.After choosing encoding as utf-8,a checkbox of BOM is enabled.Uncheck it and save the csv file.I think other editors have the same BOM option.
Then the first column is set with correct value.
No code needs to be changed.
I use the text editor named sakura.After choosing encoding as utf-8,a checkbox of BOM is enabled.Uncheck it and save the csv file.I think other editors have the same BOM option.
Reason
A BOM-ed UTF-8 string will start with the three following bytes. EF BB BF
The three bytes added to your csv file may changed your first column name.
- Rather than link to existing questions you should raise a flag to mark this question as a duplicate of the one you believe answers it. – Neil Lunn May 31 '17 at 10:25