summaryrefslogtreecommitdiffstats
path: root/lib/redmine/export
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-04-06 10:50:01 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-04-06 10:50:01 +0000
commit2f2cdfd96a9c8bd4353f2cd8bf595709343a6a20 (patch)
treecdacf75a8df27182b111da6dd8aa0dc08e4b9314 /lib/redmine/export
parent561f6bb6d195e4a9c0d31d8ec7a1b27085aefbed (diff)
downloadredmine-2f2cdfd96a9c8bd4353f2cd8bf595709343a6a20.tar.gz
redmine-2f2cdfd96a9c8bd4353f2cd8bf595709343a6a20.zip
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
Diffstat (limited to 'lib/redmine/export')
-rw-r--r--lib/redmine/export/pdf.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/redmine/export/pdf.rb b/lib/redmine/export/pdf.rb
index 5ea33e3a8..3115b8b0c 100644
--- a/lib/redmine/export/pdf.rb
+++ b/lib/redmine/export/pdf.rb
@@ -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(/\\/, "\\\\\\\\")