Browse Source

PDF: replace converting error characters instead of returning UTF-8 in FPDF ANSI on Ruby 1.8 (#61).

In Japan, UTF-8 characters in Shift_JIS(CP932) becomes garbling(MOJI-BAKE).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5351 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/1.2.0
Toshi MARUYAMA 13 years ago
parent
commit
2f2cdfd96a
1 changed files with 9 additions and 3 deletions
  1. 9
    3
      lib/redmine/export/pdf.rb

+ 9
- 3
lib/redmine/export/pdf.rb View File

@@ -151,11 +151,17 @@ module Redmine
txt.force_encoding('ASCII-8BIT')
else
@ic ||= Iconv.new(l(:general_pdf_encoding), 'UTF-8')
txt = begin
@ic.iconv(txt)
txtar = ""
begin
txtar += @ic.iconv(txt)
rescue Iconv::IllegalSequence
txtar += $!.success
txt = '?' + $!.failed[1,$!.failed.length]
retry
rescue
txt
txtar += $!.success
end
txt = txtar
end
# 0x5c char handling
txt.gsub(/\\/, "\\\\\\\\")

Loading…
Cancel
Save