Fxed encoding error when uploading files with non-ascii characters.

This commit is contained in:
Benjamin Meichsner 2013-09-02 16:46:44 +02:00
parent bf1c2b5ed2
commit 3792069fda
2 changed files with 2 additions and 2 deletions

View file

@ -36,7 +36,7 @@ class MoveWeeklyTasks < ActiveRecord::Migration
private
def weekly_task?(workgroup, task)
return false if task.due_date.nil?
group_task = {
weekday: workgroup.weekday,
name: workgroup.task_name,

View file

@ -11,7 +11,7 @@ module FoodsoftFile
def self.parse(file)
articles, outlisted_articles = Array.new, Array.new
row_index = 2
::CSV.parse(file.read, {:col_sep => ";", :headers => true}) do |row|
::CSV.parse(file.read.force_encoding('utf-8'), {:col_sep => ";", :headers => true}) do |row|
# check if the line is empty
unless row[2] == "" || row[2].nil?
article = {:number => row[1],