Japanese Shift_JIS and Traditional Chinese Big5 have '0x5c'(backslash) problem. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5343 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
470ff0c6e5
commit
a4bad14359
|
@ -143,12 +143,19 @@ module Redmine
|
||||||
end
|
end
|
||||||
|
|
||||||
def fix_text_encoding(txt)
|
def fix_text_encoding(txt)
|
||||||
@ic ||= Iconv.new(l(:general_pdf_encoding), 'UTF-8')
|
if txt.respond_to?(:force_encoding)
|
||||||
txt = begin
|
txt.force_encoding('UTF-8')
|
||||||
@ic.iconv(txt)
|
txt = txt.encode(l(:general_pdf_encoding), :invalid => :replace,
|
||||||
rescue
|
:undef => :replace, :replace => '?')
|
||||||
txt
|
txt.force_encoding('ASCII-8BIT')
|
||||||
end || ''
|
else
|
||||||
|
@ic ||= Iconv.new(l(:general_pdf_encoding), 'UTF-8')
|
||||||
|
txt = begin
|
||||||
|
@ic.iconv(txt)
|
||||||
|
rescue
|
||||||
|
txt
|
||||||
|
end || ''
|
||||||
|
end
|
||||||
# 0x5c char handling
|
# 0x5c char handling
|
||||||
txt.gsub(/\\/, "\\\\\\\\")
|
txt.gsub(/\\/, "\\\\\\\\")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue