2

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!

Evan Plaice
  • 13,944
  • 6
  • 76
  • 94
snowbaby
  • 23
  • 1
  • 4

1 Answers1

2

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.

remudada
  • 3,751
  • 2
  • 33
  • 60
  • Thanks! I'll try that. should I replace it with \n? how should I separate each line? – snowbaby Apr 13 '14 at 02:51
  • 1
    BTW, 0.81 should be able to handle any variation of newline characters without issue. FYI, I'm the author of jquery-csv. – Evan Plaice Jan 21 '16 at 14:56
  • Hi @EvanPlaice I am using jquery csv and I get [Error] Error: CSVDataError: Illegal Data whenever someone edit file in some other operating system. When I re-edit the file the error get resolved. Can you suggest a solution so that end user does not get this error? – Always_a_learner Aug 22 '16 at 06:10
  • @EvanPlaice can you please mention a link to jquery csv 0.81? Thanks. – Always_a_learner Aug 22 '16 at 06:17