-
Notifications
You must be signed in to change notification settings - Fork 244
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
First column cannot be populated #76
Comments
Hello, I just tried with this sample: b := bytes.NewBufferString(`number,column_a,column_b
1,a,b
2,c,d
3,e,f`)
var samples []Whatever
if err := Unmarshal(b, &samples); err != nil {
t.Fatal(err)
}
log.Println(samples) and it prints What method did you used? |
i read from file. If i read from string work correctly
|
solved my csv file was wrong i dont know why. |
I had a similar issue. For those who may be struggling, here was my situation/solution I had exported a .csv file from MS Excel. I exported it out in UTF-8 format (or, so I thought). The file looked fine in Notepad++ at first glance, but gocsv would not find the first column. |
@SirRamEsq I had this exact same issue. Thank you for sharing your solution! |
Yep, it's the invisible BOM characters at the beginning of the file. I wrote this up in more detail here because I had the same problem with this library. |
csv data:
my struct:
the result will be:
but if csv data like this:
the result will be:
why first column cannot be populate to struct?
The text was updated successfully, but these errors were encountered: