diff --git a/app/models/csv_db.rb b/app/models/csv_db.rb index f15b4d1..70a5090 100644 --- a/app/models/csv_db.rb +++ b/app/models/csv_db.rb @@ -1,8 +1,10 @@ require 'csv' +require 'kconv' class CsvDb class << self def convert_save(target_model, csv_data, &block) csv_file = csv_data.read + csv_file = Kconv.toutf8(csv_file) CSV.parse(csv_file, :headers => true, header_converters: :symbol ) do |row| data = row.to_hash if data.present? @@ -15,4 +17,4 @@ def convert_save(target_model, csv_data, &block) end end end -end \ No newline at end of file +end