From 600018d5adfd627f8a72d39c19f770e64b40ba72 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 23 Jun 2007 16:55:17 +0000 Subject: [PATCH] Fixed Iconv::IllegalSequence errors in csv exports git-svn-id: http://redmine.rubyforge.org/svn/trunk@570 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/projects_controller.rb | 4 ++-- app/controllers/timelog_controller.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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