Hello all,
I'm trying to import some csv data (that has latin characters) using
faster csv but I keep getting a MalformedCSVError:
"Unclosed quoted field on line 1."
"/ruby/lib/ruby/gems/1.8/gems/fastercsv-1.2.3/lib/faster_csv.rb:1592:in
`shift'"

I've tested the same code outside of the Rails application an it works
fine.
Can anyone help me?

Here is the code:

csv_options  = {
  :headers => false,
  :return_headers => false,
  :skip_blanks => false
}

csv_file_name = File.dirname(__FILE__) + "/../../Files.TXT"
data = ""
FasterCSV.foreach(csv_file_name, csv_options) do |row|
  data << row.to_s + "<br>"
end

And the first two lines in the file:
"20.1","Maria José",,"9"
"10.2","José Maria",,"10"

I'm using fastercsv 1.2.3 and rails 2.1.2

Note: I've tried adding $KCODE = "utf8" but it still does not work.

Thanks.
Best regards,
Migrate
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to