Sha256: 4a8ed04865c6401608a9cb5fcde8cbec07965fbd78bba9d04743a115cd9fbd78
Contents?: true
Size: 1.04 KB
Versions: 3
Compression:
Stored size: 1.04 KB
Contents
# frozen_string_literal: true module Mail module Jdec module UtilitiesPatch 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 if to_encoding.to_s.downcase == 'utf-8' str.gsub!(/^\x00+/, '') str.gsub!(/\x00+$/, '') end str else super end end end end end unless Mail::Utilities.singleton_class.included_modules.include?(Mail::Jdec::UtilitiesPatch) Mail::Utilities.singleton_class.prepend Mail::Jdec::UtilitiesPatch end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mail-jdec-1.1.2 | lib/mail/jdec/utilities_patch.rb |
mail-jdec-1.1.1 | lib/mail/jdec/utilities_patch.rb |
mail-jdec-1.1.0 | lib/mail/jdec/utilities_patch.rb |