views:

385

answers:

2

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
A: 

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

http://stackoverflow.com/questions/1328250/how-do-i-import-using-fastercsv-a-row-with-a-name-like-ciaran

benjynito
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
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?
benjynito
A: 

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.

egarcia