My goal is to upload a file containing rows of firstname and lastname, parse it and create Person model in db for each row.
I do the following and it works fine
file = CSV.parse(the_file_to_parse)
file.each do |row|
person = Person.new(:firstname => row[0], :lastname => row[1])
person.save
end
until my file contains accents (french words), I get
Encoding::UndefinedConversionError: "\xC3" from ASCII-8BIT to UTF-8:
INSERT INTO "people" ("created_at", "firstname", "lastname",
"updated_at") VALUES (?, ?, ?, ?)
What is the best way to deal with this encoding issue?