# File lib/mail/encodings/encodings.rb, line 114 def Encodings.unquote_and_convert_to(str, to_encoding) original_encoding, string = split_encoding_from_string( str ) output = value_decode( str ).to_s if original_encoding.to_s.downcase.gsub("-", "") == to_encoding.to_s.downcase.gsub("-", "") output elsif original_encoding && to_encoding begin require 'iconv' Iconv.iconv(to_encoding, original_encoding, output).first rescue Iconv::IllegalSequence, Iconv::InvalidEncoding, Errno::EINVAL # the 'from' parameter specifies a charset other than what the text # actually is...not much we can do in this case but just return the # unconverted text. # # Ditto if either parameter represents an unknown charset, like # X-UNKNOWN. output end else output end end