Project

General

Profile

Defect #61 » pdf.rb_illegal_character.patch

Jun NAITOH, 2011-04-06 01:08

View differences:

lib/redmine/export/pdf.rb 2011-04-06 06:56:13.000000000 +0900 → lib/redmine/export/pdf.rb 2011-04-06 06:57:32.000000000 +0900
def fix_text_encoding(txt)
@ic ||= Iconv.new(l(:general_pdf_encoding), 'UTF-8')
txt = begin
# 0x5c char handling
txtar = txt.split('\\')
txtar << '' if txt[-1] == ?\\
txtar.collect {|x| @ic.iconv(x)}.join('\\').gsub(/\\/, "\\\\\\\\")
txtar = ""
begin
txtar += @ic.iconv(txt)
rescue Iconv::IllegalSequence
txtar += $!.success
txt = $!.failed[1,$!.failed.length]
retry
rescue
txt
end || ''
return txt
txtar += $!.success
end
# 0x5c char handling
return txtar.gsub(/\\/, "\\\\\\\\")
end
def RDMCell(w,h=0,txt='',border=0,ln=0,align='',fill=0,link='')
(36-36/46)