开发者

Fastercsv shows malformedCSVError, what am i doing wrong?

I am implementing in Ruby and i am running a project which reads a CSV file to add users.

but when i pick my file it just gives always the same error:

FasterCSV::MalformedCSVError in User importController#match

Illegal quoting on line 1.

my CSV file just exist开发者_StackOverflows of :

"RubenPersoon1","test","Bauwens","Ruben","rub@gmail.com",0

anyone who knows what can be wrong?


Try to upgrade your FasterCSV gem version. With the latest version it works:

FasterCSV.parse_line '"RubenPersoon1","test","Bauwens","Ruben","rub@gmail.com",0'
 => ["RubenPersoon1", "test", "Bauwens", "Ruben", "rub@gmail.com", "0"] 
ruby-1.8.7-p352 :005 > FasterCSV.parse '"RubenPersoon1","test","Bauwens","Ruben","rub@gmail.com",0'
 => [["RubenPersoon1", "test", "Bauwens", "Ruben", "rub@gmail.com", "0"]]

Also, keep in mind that if you are on Ruby 1.9.2, FasterCSV is already included. Just require 'csv' and use the CSV class.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜