javascriptjquerycsvjquery-csv

reading CSV error: Illegal Data. What's happening?


I'm having the following error, and I have no idea what's going on...

Here is the first row in my csv file (I opened it using vim)

longitude,latitude,ph,ammonium_nitrate,phosphate,permanganate,heavy_metal,email_address^M

Here is the error I see in my safari console:

[Error] Error: CSVDataError: Illegal Data [Row:1][Col:8]
(anonymous function) (jquery-csv-0.71.js, line 253)
replace
parse (jquery-csv-0.71.js, line 160)
toArrays (jquery-csv-0.71.js, line 664)
success (demo.html, line 64)
c (jquery-1.10.2.min.js, line 4)
fireWith (jquery-1.10.2.min.js, line 4)
k (jquery-1.10.2.min.js, line 6)
r (jquery-1.10.2.min.js, line 6)

Any suggestions will be appreciated!! Thanks a lot!


Solution

  • The file appears to be imported from a windows box (due to the presence of the ^M character). If you are working with this file in linux your parser may not like it. Remove the ^M from your file.