Class | XSD::IconvCharset |
In: |
lib/xsd/iconvcharset.rb
|
Parent: | Object |
# File lib/xsd/iconvcharset.rb, line 16 16: def self.safe_iconv(to, from, str) 17: iconv = Iconv.new(to, from) 18: out = "" 19: begin 20: out << iconv.iconv(str) 21: rescue Iconv::IllegalSequence => e 22: out << e.success 23: ch, str = e.failed.split(//, 2) 24: out << '?' 25: warn("Failed to convert #{ch}") 26: retry 27: end 28: return out 29: end