]> source.dussan.org Git - redmine.git/commitdiff
Fixed Iconv::IllegalSequence errors in csv exports
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 23 Jun 2007 16:55:17 +0000 (16:55 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 23 Jun 2007 16:55:17 +0000 (16:55 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@570 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/projects_controller.rb
app/controllers/timelog_controller.rb

index 0f9b0f52c5a8e3be59359e0b92c534b318284ee9..8f7969febe29d6919a5f75be1c750d92b5dfbd21 100644 (file)
@@ -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
index c07a76060dfc1703d8ebf82ccde9688e682b2ccc..da323fbf13d6e9bbbaffc97b3705f4b0a6be40ff 100644 (file)
@@ -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