class Mail::Encodings::QuotedPrintable

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