0

Sample data:

"iWine","Barcode","Location","Bin","Size","Valuation","Price","StoreName",\ "PurchaseDate","Note","Vintage","Wine","Locale","Country","Region","SubRegion",\ "Appellation","Producer","SortProducer","Type","Color","Category","Varietal",\ "MasterVarietal","Designation","Vineyard","WA","WS","IWC","BG","WE","JR",\ "RH","JG","GV","JK","LD","CW","CT","MY","BeginConsume","EndConsume"

"334142","15240542","Cellar","","750ml","","0","","","","2003",\
"Bodegas y Viñedos Alión Ribera del Duero","Spain, Castilla y León, Ribera del Duero","Spain",\
"Castilla y León","Unknown","Ribera del Duero","Bodegas y Viñedos Alión",\
"Alión, Bodegas y Viñedos","Red","Red","Dry","Tempranillo","Tempranillo","Unknown","Unknown",\
"","","","","","","","","","","","","91.3333333333333","","2011","2021"

FasterCSV insists on raising MalformedCSVError when parsing this data, specifically thrown around line 1616 in faster_csv.rb

raise MalformedCSVError unless in_quotes
Kyle
  • 1,054
  • 2
  • 14
  • 27
  • This is difficult to read. Can you edit it onto several more lines? – pavium Sep 01 '09 at 20:42
  • Could it be the last comma on a line? Maybe either use a pair of empty quotes ("") or take out the last comma? Not familiar with the class, but it sounds like it wants EVERYTHING in quotes by your error. – John Hoven Sep 01 '09 at 20:57

2 Answers2

0

Also - did you check out related posts about the encoding?

How do I import using FasterCSV a row with a name like "Ciarán"?

Community
  • 1
  • 1
John Hoven
  • 4,085
  • 2
  • 28
  • 32
  • I did. Doing some more testing (and remembering a similar issue I had a while back), I copy and pasted the contents of the csv into a new file, and it works as expected. Thoughts on that? Maybe came through (it was exported from Google Spreadsheet) with mucked up char encoding or something along those lines? – Kyle Sep 01 '09 at 21:28
  • Yea, I'm not really sure. Do you specify the flag on the command? Seems like it would be easier than ensuring your file was in the right format? – John Hoven Sep 02 '09 at 01:04
0

I'd guess that the issues you are having are due to the non-ascii characters.

Try replacing them with non-accents, and see if it works. If it does, you must use the :encoding option on FasterCSV to match your file's format.

kikito
  • 51,734
  • 32
  • 149
  • 189