]> source.dussan.org Git - redmine.git/commitdiff
add functional test to export issue csv encoded in Big5 on Traditional Chinese locale...
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 16 Nov 2011 13:49:40 +0000 (13:49 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 16 Nov 2011 13:49:40 +0000 (13:49 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7821 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/functional/issues_controller_test.rb

index e0b71f6af3d8662b4cfd087303949658a5da8c36..bdee16eadde82758d8a97c98aae0c109d48cbc34 100644 (file)
@@ -296,6 +296,34 @@ class IssuesControllerTest < ActionController::TestCase
     assert_equal 'text/csv', @response.content_type
   end
 
+  def test_index_csv_big_5
+    with_settings :default_language => "zh-TW" do
+      str_utf8  = "\xe4\xb8\x80\xe6\x9c\x88"
+      str_big5  = "\xa4@\xa4\xeb"
+      if str_utf8.respond_to?(:force_encoding)
+        str_utf8.force_encoding('UTF-8')
+        str_big5.force_encoding('Big5')
+      end
+      issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 3,
+                        :status_id => 1, :priority => IssuePriority.all.first,
+                        :subject => str_utf8)
+      assert issue.save
+
+      get :index, :project_id => 1, 
+                  :f => ['subject'], 
+                  :op => '=', :values => [str_utf8],
+                  :format => 'csv'
+      assert_equal 'text/csv', @response.content_type
+      lines = @response.body.chomp.split("\n")    
+      s1 = "\xaa\xac\xbaA"
+      if str_utf8.respond_to?(:force_encoding)
+        s1.force_encoding('Big5')
+      end
+      assert lines[0].include?(s1)
+      assert lines[1].include?(str_big5)
+    end
+  end
+
   def test_index_pdf
     get :index, :format => 'pdf'
     assert_response :success