class Mail::Encodings::QuotedPrintable

def self.can_encode?(enc)

def self.can_encode?(enc)
  EightBit.can_encode? enc
end

def self.compatible_input?(str)

QP inserts newlines automatically and cannot violate the SMTP spec.
def self.compatible_input?(str)
  true
end

def self.cost(str)

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

def self.decode(str)

that were incorrectly encoded as hex instead of literal CRLF.
Decode the string from Quoted-Printable. Cope with hard line breaks
def self.decode(str)
  ::Mail::Utilities.to_lf ::Mail::Utilities.to_crlf(str).gsub(/(?:=0D=0A|=0D|=0A)\r\n/, "\r\n").unpack("M*").first
end

def self.encode(str)

def self.encode(str)
  ::Mail::Utilities.to_crlf [::Mail::Utilities.to_lf(str)].pack("M")
end