@@ -66,4 +66,20 class PdfTest < ActiveSupport::TestCase | |||||
66 | assert_equal "\x91\xe3\x95\\\\a\\\\", |
|
66 | assert_equal "\x91\xe3\x95\\\\a\\\\", | |
67 | pdf.fix_text_encoding("\xe4\xbb\xa3\xe8\xa1\xa8a\\") |
|
67 | pdf.fix_text_encoding("\xe4\xbb\xa3\xe8\xa1\xa8a\\") | |
68 | end |
|
68 | end | |
|
69 | ||||
|
70 | def test_fix_text_encoding_cannot_convert_ja_cp932 | |||
|
71 | pdf = Redmine::Export::PDF::IFPDF.new('ja') | |||
|
72 | assert pdf | |||
|
73 | utf8_txt_1 = "\xe7\x8b\x80\xe6\x85\x8b" | |||
|
74 | utf8_txt_2 = "\xe7\x8b\x80\xe6\x85\x8b\xe7\x8b\x80" | |||
|
75 | utf8_txt_3 = "\xe7\x8b\x80\xe7\x8b\x80\xe6\x85\x8b\xe7\x8b\x80" | |||
|
76 | if utf8_txt_1.respond_to?(:force_encoding) | |||
|
77 | assert_equal "?\x91\xd4", | |||
|
78 | pdf.fix_text_encoding(utf8_txt_1) | |||
|
79 | assert_equal "?\x91\xd4?", | |||
|
80 | pdf.fix_text_encoding(utf8_txt_2) | |||
|
81 | assert_equal "??\x91\xd4?", | |||
|
82 | pdf.fix_text_encoding(utf8_txt_3) | |||
|
83 | end | |||
|
84 | end | |||
69 | end |
|
85 | end |
General Comments 0
You need to be logged in to leave comments.
Login now