Merged r6024 from trunk.
PDF: replace all non ASCII characters to '?' if Iconv error raise in JRuby. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.2-stable@6027 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -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 = ""
|
||||
|
||||
Reference in New Issue
Block a user