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

@ -11,7 +11,7 @@ module FoodsoftFile
def self.parse(file) def self.parse(file)
articles, outlisted_articles = Array.new, Array.new articles, outlisted_articles = Array.new, Array.new
row_index = 2 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 # check if the line is empty
unless row[2] == "" || row[2].nil? unless row[2] == "" || row[2].nil?
article = {:number => row[1], article = {:number => row[1],