3 def Ruby18.b_value_decode(str)
4 match = str.match(/\=\?(.+)?\?[Bb]\?(.+)?\?\=/m)
7 str = Ruby18.decode_base64(match[2])
9 str = Iconv.conv("UTF-8//TRANSLIT//IGNORE", encoding, str)
14 def Ruby18.q_value_decode(str)
15 match = str.match(/\=\?(.+)?\?[Qq]\?(.+)?\?\=/m)
18 str = Encodings::QuotedPrintable.decode(match[2].gsub(/_/, '=20'))
20 str = Iconv.conv("UTF-8//TRANSLIT//IGNORE", encoding, str)
35 alias_method_chain :decoded, :text
38 has_content_type? ? !!(main_type =~ /^text$/i) : false
43 def decode_body_as_text
44 body_text = body.decoded
46 if RUBY_VERSION < '1.9'
48 return Iconv.conv("UTF-8//TRANSLIT//IGNORE", charset, body_text)
50 if encoding = Encoding.find(charset) rescue nil
51 body_text.force_encoding(encoding)
52 return body_text.encode(Encoding::UTF_8)