diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2014-09-11 14:55:24 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2014-09-11 14:55:24 +0000 |
commit | 5286e194d583039e10bb95710302a5ab9201c0f5 (patch) | |
tree | fc860656b245e2137f2ea33284d755f2852f3a0b | |
parent | 9ca659068b5904d2cc42394d9dc8e5873d20d1f5 (diff) | |
download | redmine-5286e194d583039e10bb95710302a5ab9201c0f5.tar.gz redmine-5286e194d583039e10bb95710302a5ab9201c0f5.zip |
2.4-stable: pdf: fix failure exporting issue pdf with UTF-8 U+FFFD (#17826)
This revision has trunk r13368 and r13369 test.
git-svn-id: http://svn.redmine.org/redmine/branches/2.4-stable@13371 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | lib/plugins/rfpdf/lib/tcpdf.rb | 2 | ||||
-rw-r--r-- | test/functional/issues_controller_test.rb | 16 |
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/plugins/rfpdf/lib/tcpdf.rb b/lib/plugins/rfpdf/lib/tcpdf.rb index d754eb891..781fbcfc0 100644 --- a/lib/plugins/rfpdf/lib/tcpdf.rb +++ b/lib/plugins/rfpdf/lib/tcpdf.rb @@ -1,3 +1,5 @@ +# encoding: ascii-8bit + #============================================================+ # File name : tcpdf.rb # Begin : 2002-08-03 diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 4acc9fdd6..2d855b2c0 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -1395,6 +1395,22 @@ class IssuesControllerTest < ActionController::TestCase assert_not_nil assigns(:issue) end + def test_export_to_pdf_with_utf8_u_fffd + # U+FFFD + s = "\xef\xbf\xbd" + s.force_encoding('UTF-8') if s.respond_to?(:force_encoding) + issue = Issue.generate!(:subject => s) + ["en", "zh", "zh-TW", "ja", "ko"].each do |lang| + with_settings :default_language => lang do + get :show, :id => issue.id, :format => 'pdf' + assert_response :success + assert_equal 'application/pdf', @response.content_type + assert @response.body.starts_with?('%PDF') + assert_not_nil assigns(:issue) + end + end + end + def test_show_export_to_pdf_with_ancestors issue = Issue.generate!(:project_id => 1, :author_id => 2, :tracker_id => 1, :subject => 'child', :parent_issue_id => 1) |