From: Jean-Philippe Lang Date: Sat, 23 Jun 2007 16:55:17 +0000 (+0000) Subject: Fixed Iconv::IllegalSequence errors in csv exports X-Git-Tag: 0.5.1~23 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=600018d5adfd627f8a72d39c19f770e64b40ba72;p=redmine.git Fixed Iconv::IllegalSequence errors in csv exports git-svn-id: http://redmine.rubyforge.org/svn/trunk@570 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 0f9b0f52c..8f7969feb 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -325,7 +325,7 @@ class ProjectsController < ApplicationController for custom_field in @project.all_custom_fields headers << custom_field.name end - csv << headers.collect {|c| ic.iconv(c) } + csv << headers.collect {|c| begin; ic.iconv(c.to_s); rescue; c.to_s; end } # csv lines @issues.each do |issue| fields = [issue.id, issue.status.name, @@ -344,7 +344,7 @@ class ProjectsController < ApplicationController for custom_field in @project.all_custom_fields fields << (show_value issue.custom_value_for(custom_field)) end - csv << fields.collect {|c| ic.iconv(c.to_s) } + csv << fields.collect {|c| begin; ic.iconv(c.to_s); rescue; c.to_s; end } end end export.rewind diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb index c07a76060..da323fbf1 100644 --- a/app/controllers/timelog_controller.rb +++ b/app/controllers/timelog_controller.rb @@ -61,7 +61,7 @@ private l(:field_hours), l(:field_comments) ] - csv << headers.collect {|c| ic.iconv(c) } + csv << headers.collect {|c| begin; ic.iconv(c.to_s); rescue; c.to_s; end } # csv lines @entries.each do |entry| fields = [l_date(entry.spent_on), @@ -71,7 +71,7 @@ private entry.hours, entry.comments ] - csv << fields.collect {|c| ic.iconv(c.to_s) } + csv << fields.collect {|c| begin; ic.iconv(c.to_s); rescue; c.to_s; end } end end export.rewind