summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-11-27 10:53:08 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-11-27 10:53:08 +0000
commitb95fd6315c9b82eb65244b1a5b13bd1b69afe529 (patch)
treeeff340b2dcefccac5987dbc9c765302fbcfaa0cb
parentf680e7f8acc14257bb585ef43a0a0572bdef0bdd (diff)
downloadredmine-b95fd6315c9b82eb65244b1a5b13bd1b69afe529.tar.gz
redmine-b95fd6315c9b82eb65244b1a5b13bd1b69afe529.zip
fix time entry csv last line encoding (#8549)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7947 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/helpers/timelog_helper.rb3
-rw-r--r--test/functional/time_entry_reports_controller_test.rb3
2 files changed, 5 insertions, 1 deletions
diff --git a/app/helpers/timelog_helper.rb b/app/helpers/timelog_helper.rb
index ed944b282..c5559db25 100644
--- a/app/helpers/timelog_helper.rb
+++ b/app/helpers/timelog_helper.rb
@@ -153,7 +153,8 @@ module TimelogHelper
# Content
report_criteria_to_csv(csv, criterias, periods, hours)
# Total row
- row = [ l(:label_total) ] + [''] * (criterias.size - 1)
+ str_total = Redmine::CodesetUtil.from_utf8(l(:label_total), l(:general_csv_encoding))
+ row = [ str_total ] + [''] * (criterias.size - 1)
total = 0
periods.each do |period|
sum = sum_hours(select_hours(hours, @columns, period.to_s))
diff --git a/test/functional/time_entry_reports_controller_test.rb b/test/functional/time_entry_reports_controller_test.rb
index c6a41122e..0fac8294a 100644
--- a/test/functional/time_entry_reports_controller_test.rb
+++ b/test/functional/time_entry_reports_controller_test.rb
@@ -181,12 +181,15 @@ class TimeEntryReportsControllerTest < ActionController::TestCase
lines = @response.body.chomp.split("\n")
# Headers
s1 = "\xa6\xa8\xad\xfb,2011-11-11,\xc1`\xadp"
+ s2 = "\xc1`\xadp"
if s1.respond_to?(:force_encoding)
s1.force_encoding('Big5')
+ s2.force_encoding('Big5')
end
assert_equal s1, lines.first
# Total row
assert_equal "#{str_big5} #{user.lastname},7.30,7.30", lines[1]
+ assert_equal "#{s2},7.30,7.30", lines[2]
end
def test_csv_cannot_convert_should_be_replaced_big_5