Fixed Iconv::IllegalSequence errors in csv exports

git-svn-id: http://redmine.rubyforge.org/svn/trunk@570 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-06-23 16:55:17 +00:00
parent ec44c94c12
commit 600018d5ad
2 changed files with 4 additions and 4 deletions

View File

@ -325,7 +325,7 @@ class ProjectsController < ApplicationController
for custom_field in @project.all_custom_fields for custom_field in @project.all_custom_fields
headers << custom_field.name headers << custom_field.name
end 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 # csv lines
@issues.each do |issue| @issues.each do |issue|
fields = [issue.id, issue.status.name, fields = [issue.id, issue.status.name,
@ -344,7 +344,7 @@ class ProjectsController < ApplicationController
for custom_field in @project.all_custom_fields for custom_field in @project.all_custom_fields
fields << (show_value issue.custom_value_for(custom_field)) fields << (show_value issue.custom_value_for(custom_field))
end 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
end end
export.rewind export.rewind

View File

@ -61,7 +61,7 @@ private
l(:field_hours), l(:field_hours),
l(:field_comments) 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 # csv lines
@entries.each do |entry| @entries.each do |entry|
fields = [l_date(entry.spent_on), fields = [l_date(entry.spent_on),
@ -71,7 +71,7 @@ private
entry.hours, entry.hours,
entry.comments 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
end end
export.rewind export.rewind