Sha256: 2710e9849d88b42f0528c9acbeffe93e1d662de7ec94d29803c5cabea12c2cfb

Contents?: true

Size: 642 Bytes

Versions: 25

Compression:

Stored size: 642 Bytes

Contents

# encoding: utf-8
module Mail
  module Encodings
    class QuotedPrintable
    
      # Decode the string from Quoted-Printable
      def self.decode(str)
        str.unpack("M*").first
      end

      def self.encode(str)
        str.gsub( /[^a-z ]/i ) { quoted_printable_encode($&) }
      end

      private

      # Convert the given character to quoted printable format, taking into
      # account multi-byte characters (if executing with $KCODE="u", for instance)
      def self.quoted_printable_encode(character)
        result = ""
        character.each_byte { |b| result << "=%02X" % b }
        result
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
mail-2.1.3 lib/mail/encodings/quoted_printable.rb
kbaum-mail-2.1.2.1 lib/mail/encodings/quoted_printable.rb
mail-2.1.2 lib/mail/encodings/quoted_printable.rb
mail-2.1.1 lib/mail/encodings/quoted_printable.rb
mail-2.1.0 lib/mail/encodings/quoted_printable.rb
mail-2.0.5 lib/mail/encodings/quoted_printable.rb
mail-2.0.3 lib/mail/encodings/quoted_printable.rb
mail-1.6.0 lib/mail/encodings/quoted_printable.rb
mail-1.5.4 lib/mail/encodings/quoted_printable.rb
mail-1.5.3 lib/mail/encodings/quoted_printable.rb
mail-1.5.2 lib/mail/encodings/quoted_printable.rb
mail-1.5.1 lib/mail/encodings/quoted_printable.rb
mail-1.5.0 lib/mail/encodings/quoted_printable.rb
mail-1.4.3 lib/mail/encodings/quoted_printable.rb
mail-1.4.2 lib/mail/encodings/quoted_printable.rb
mail-1.4.1 lib/mail/encodings/quoted_printable.rb
mail-1.4.0 lib/mail/encodings/quoted_printable.rb
mail-1.3.5 lib/mail/encodings/quoted_printable.rb
mail-1.3.4 lib/mail/encodings/quoted_printable.rb
mail-1.3.3 lib/mail/encodings/quoted_printable.rb