From 411c7100cb7331968bef08458e0999959661099c Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Wed, 6 Apr 2011 05:39:26 +0000 Subject: [PATCH] PDF: add test of Ruby 1.9 compatibility of '0x5c'(backslash) handling in FPDF ANSI (#61, #117). Japanese Shift_JIS and Traditional Chinese Big5 have '0x5c'(backslash) problem. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5344 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/unit/lib/redmine/export/pdf_test.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/unit/lib/redmine/export/pdf_test.rb b/test/unit/lib/redmine/export/pdf_test.rb index a6ff6589a..0281b6a92 100644 --- a/test/unit/lib/redmine/export/pdf_test.rb +++ b/test/unit/lib/redmine/export/pdf_test.rb @@ -44,4 +44,19 @@ class PdfTest < ActiveSupport::TestCase assert_equal '\\\\\\\\abcd\\\\\\\\abcd\\\\\\\\', pdf.fix_text_encoding('\\\\abcd\\\\abcd\\\\') end + + def test_fix_text_encoding_backslash_ja_cp932 + pdf = Redmine::Export::PDF::IFPDF.new('ja') + assert pdf + assert_equal "\x83\\\\\x98A", + pdf.fix_text_encoding("\xe3\x82\xbd\xe9\x80\xa3") + assert_equal "\x83\\\\\x98A\x91\xe3\x95\\\\", + pdf.fix_text_encoding("\xe3\x82\xbd\xe9\x80\xa3\xe4\xbb\xa3\xe8\xa1\xa8") + assert_equal "\x91\xe3\x95\\\\\\\\", + pdf.fix_text_encoding("\xe4\xbb\xa3\xe8\xa1\xa8\\") + assert_equal "\x91\xe3\x95\\\\\\\\\\\\", + pdf.fix_text_encoding("\xe4\xbb\xa3\xe8\xa1\xa8\\\\") + assert_equal "\x91\xe3\x95\\\\a\\\\", + pdf.fix_text_encoding("\xe4\xbb\xa3\xe8\xa1\xa8a\\") + end end -- 2.39.5