@@ -408,6 +408,13 module Redmine | |||||
408 | txt = Redmine::CodesetUtil.replace_invalid_utf8(txt) |
|
408 | txt = Redmine::CodesetUtil.replace_invalid_utf8(txt) | |
409 | end |
|
409 | end | |
410 | txt.force_encoding('ASCII-8BIT') |
|
410 | txt.force_encoding('ASCII-8BIT') | |
|
411 | elsif RUBY_PLATFORM == 'java' | |||
|
412 | begin | |||
|
413 | ic ||= Iconv.new(l(:general_pdf_encoding), 'UTF-8') | |||
|
414 | txt = ic.iconv(txt) | |||
|
415 | rescue | |||
|
416 | txt = txt.gsub(%r{[^\r\n\t\x20-\x7e]}, '?') | |||
|
417 | end | |||
411 | else |
|
418 | else | |
412 | ic ||= Iconv.new(l(:general_pdf_encoding), 'UTF-8') |
|
419 | ic ||= Iconv.new(l(:general_pdf_encoding), 'UTF-8') | |
413 | txtar = "" |
|
420 | txtar = "" |
@@ -57,6 +57,13 class PdfTest < ActiveSupport::TestCase | |||||
57 | assert_equal "ASCII-8BIT", txt_1.encoding.to_s |
|
57 | assert_equal "ASCII-8BIT", txt_1.encoding.to_s | |
58 | assert_equal "ASCII-8BIT", txt_2.encoding.to_s |
|
58 | assert_equal "ASCII-8BIT", txt_2.encoding.to_s | |
59 | assert_equal "ASCII-8BIT", txt_3.encoding.to_s |
|
59 | assert_equal "ASCII-8BIT", txt_3.encoding.to_s | |
|
60 | elsif RUBY_PLATFORM == 'java' | |||
|
61 | assert_equal "??", | |||
|
62 | Redmine::Export::PDF::RDMPdfEncoding::rdm_pdf_iconv(ic, utf8_txt_1) | |||
|
63 | assert_equal "???", | |||
|
64 | Redmine::Export::PDF::RDMPdfEncoding::rdm_pdf_iconv(ic, utf8_txt_2) | |||
|
65 | assert_equal "????", | |||
|
66 | Redmine::Export::PDF::RDMPdfEncoding::rdm_pdf_iconv(ic, utf8_txt_3) | |||
60 | else |
|
67 | else | |
61 | assert_equal "???\x91\xd4", |
|
68 | assert_equal "???\x91\xd4", | |
62 | Redmine::Export::PDF::RDMPdfEncoding::rdm_pdf_iconv(ic, utf8_txt_1) |
|
69 | Redmine::Export::PDF::RDMPdfEncoding::rdm_pdf_iconv(ic, utf8_txt_1) |
General Comments 0
You need to be logged in to leave comments.
Login now