我有个 seed 文件 myseed.csv,内含法文,是 utf8 编码的,
>file myseed.csv
myseed.csv : UTF-8 Unicode English text
运行 rake db:seed 的时候会提示
incompatible character encodings: UTF-8 and ASCII-8BIT
寻帮助,谢谢先
sorry,附上代码
seed.rb
CSV.read(File.dirname(__FILE__) + "/seeds_data/myseed.csv",:headers => true).each do |row|
MyClass.create(row.to_hash)
end
数据 "m_id","e_id","geo","country","name","full_name" 3,1006332,"City","FR","Bagnols-en-Forêt","Bagnols-en-Forêt,Provence-Alpes-Côte d'Azur,France"