summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-06-09 03:41:26 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-06-09 03:41:26 +0000
commitb85092c702bd38f351da3587a056a75183e2eac1 (patch)
treeb4adf3ae3d79104ff065b62c6bae95e4242bd450 /lib
parent2c803670d808f5e8e00f37b513b23a3620f27d9f (diff)
downloadredmine-b85092c702bd38f351da3587a056a75183e2eac1.tar.gz
redmine-b85092c702bd38f351da3587a056a75183e2eac1.zip
PDF: replace all non ASCII characters to '?' if Iconv error raise in JRuby (#8569, #61).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6024 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/export/pdf.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/redmine/export/pdf.rb b/lib/redmine/export/pdf.rb
index 3203c19a8..97176a7f9 100644
--- a/lib/redmine/export/pdf.rb
+++ b/lib/redmine/export/pdf.rb
@@ -408,6 +408,13 @@ module Redmine
txt = Redmine::CodesetUtil.replace_invalid_utf8(txt)
end
txt.force_encoding('ASCII-8BIT')
+ elsif RUBY_PLATFORM == 'java'
+ begin
+ ic ||= Iconv.new(l(:general_pdf_encoding), 'UTF-8')
+ txt = ic.iconv(txt)
+ rescue
+ txt = txt.gsub(%r{[^\r\n\t\x20-\x7e]}, '?')
+ end
else
ic ||= Iconv.new(l(:general_pdf_encoding), 'UTF-8')
txtar = ""