Defect #61 » pdf.rb_illegal_character.patch
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 | ||
---|---|---|
144 | 144 | |
145 | 145 |
def fix_text_encoding(txt) |
146 | 146 |
@ic ||= Iconv.new(l(:general_pdf_encoding), 'UTF-8') |
147 |
txt = begin |
|
148 |
# 0x5c char handling |
|
149 |
txtar = txt.split('\\') |
|
150 |
txtar << '' if txt[-1] == ?\\ |
|
151 |
txtar.collect {|x| @ic.iconv(x)}.join('\\').gsub(/\\/, "\\\\\\\\") |
|
147 |
txtar = "" |
|
148 |
begin |
|
149 |
txtar += @ic.iconv(txt) |
|
150 |
rescue Iconv::IllegalSequence |
|
151 |
txtar += $!.success |
|
152 |
txt = $!.failed[1,$!.failed.length] |
|
153 |
retry |
|
152 | 154 |
rescue |
153 |
txt |
|
154 |
end || '' |
|
155 |
return txt |
|
155 |
txtar += $!.success |
|
156 |
end |
|
157 |
# 0x5c char handling |
|
158 |
return txtar.gsub(/\\/, "\\\\\\\\") |
|
156 | 159 |
end |
157 | 160 | |
158 | 161 |
def RDMCell(w,h=0,txt='',border=0,ln=0,align='',fill=0,link='') |