Sha256: eabd013b8e414a9ad7a601fdd908ef8d9fc70996105d1094561b13885b093f87
Contents?: true
Size: 973 Bytes
Versions: 1
Compression:
Stored size: 973 Bytes
Contents
# frozen_string_literal: true module Mail module Jdec module UtilitiesPatch def pick_encoding(charset) if Jdec.enabled? Jdec.config.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 if to_encoding.to_s.downcase == 'utf-8' str.gsub!(/^\x00+/, '') str.gsub!(/\x00+$/, '') end str else super end end end end end Mail::Utilities.singleton_class.prepend Mail::Jdec::UtilitiesPatch
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mail-jdec-1.2.0 | lib/mail/jdec/utilities_patch.rb |