class Mail::Encodings::QuotedPrintable

Constants

NAME
PRIORITY

Public Class Methods

can_encode?(str) click to toggle source
# File lib/mail/encodings/quoted_printable.rb, line 10
def self.can_encode?(str)
  EightBit.can_encode? str
end
cost(str) click to toggle source
# File lib/mail/encodings/quoted_printable.rb, line 23
def self.cost(str)
  # These bytes probably do not need encoding
  c = str.count("\x9\\xA\\xD\\x20-\x3C\x3E-\x7E")
  # Everything else turns into =XX where XX is a 
  # two digit hex number (taking 3 bytes)
  total = (str.bytesize - c)*3 + c
  total.to_f/str.bytesize
end
decode(str) click to toggle source

Decode the string from Quoted-Printable

# File lib/mail/encodings/quoted_printable.rb, line 15
def self.decode(str)
  str.unpack("M*").first
end
encode(str) click to toggle source
# File lib/mail/encodings/quoted_printable.rb, line 19
def self.encode(str)
  [str].pack("M").to_crlf
end