Sha256: 3077b44af193a7b1049daf6fe9f5f26333500c178c08e2ed5c5f8ad35f68675c
Contents?: true
Size: 944 Bytes
Versions: 5
Compression:
Stored size: 944 Bytes
Contents
module Mail module Jdec module Ruby19Patch def pick_encoding(charset) if Jdec.enabled? Jdec.preferred_charsets.each do |from, to| if charset.to_s.downcase == from return Encoding.find(to) end end end super end def transcode_charset(str, from_encoding, to_encoding = Encoding::UTF_8) if Jdec.enabled? case from_encoding.to_s.downcase when 'unicode-1-1-utf-7' str = Decoder.decode_utf7(str).encode(to_encoding, undef: :replace, invalid: :replace) else str = super end str.strip! if to_encoding.to_s.downcase == 'utf-8' str else super end end end end end unless Mail::Ruby19.singleton_class.included_modules.include?(Mail::Jdec::Ruby19Patch) Mail::Ruby19.singleton_class.prepend Mail::Jdec::Ruby19Patch end
Version data entries
5 entries across 5 versions & 1 rubygems