summaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-11-16 08:10:53 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-11-16 08:10:53 +0000
commit4b5d50e40a4907cdbd4efa9100dbb51c7e534e3f (patch)
tree4c0a134bc813162c244cdbf890bd70eeea20c162 /app/helpers
parent8433bbab69c6e18074383b73d820368f8bdddfbe (diff)
downloadredmine-4b5d50e40a4907cdbd4efa9100dbb51c7e534e3f.tar.gz
redmine-4b5d50e40a4907cdbd4efa9100dbb51c7e534e3f.zip
fix malformed time log csv encoding in case of unable to convert (#8549)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7819 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/timelog_helper.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/app/helpers/timelog_helper.rb b/app/helpers/timelog_helper.rb
index 65a23f89c..6b34e60b0 100644
--- a/app/helpers/timelog_helper.rb
+++ b/app/helpers/timelog_helper.rb
@@ -84,7 +84,6 @@ module TimelogHelper
end
def entries_to_csv(entries)
- ic = Iconv.new(l(:general_csv_encoding), 'UTF-8')
decimal_separator = l(:general_csv_decimal_separator)
custom_fields = TimeEntryCustomField.find(:all)
export = FCSV.generate(:col_sep => l(:general_csv_separator)) do |csv|
@@ -102,7 +101,9 @@ module TimelogHelper
# Export custom fields
headers += custom_fields.collect(&:name)
- csv << headers.collect {|c| begin; ic.iconv(c.to_s); rescue; c.to_s; end }
+ csv << headers.collect {|c| Redmine::CodesetUtil.from_utf8(
+ c.to_s,
+ l(:general_csv_encoding) ) }
# csv lines
entries.each do |entry|
fields = [format_date(entry.spent_on),
@@ -117,7 +118,9 @@ module TimelogHelper
]
fields += custom_fields.collect {|f| show_value(entry.custom_value_for(f)) }
- csv << fields.collect {|c| begin; ic.iconv(c.to_s); rescue; c.to_s; end }
+ csv << fields.collect {|c| Redmine::CodesetUtil.from_utf8(
+ c.to_s,
+ l(:general_csv_encoding) ) }
end
end
export