module Mail::ParserTools

Public Instance Methods

chars(data, from_bytes, to_bytes) click to toggle source
# File lib/loose_mail.rb, line 43
def chars(data, from_bytes, to_bytes)
  s = data.slice(from_bytes..to_bytes)
  if from_bytes != 0 && data[from_bytes - 1] == '"' && data[to_bytes + 1] == '"' # quoted string
    s.gsub!(/\\(.)/) { $1 }
  end
  s.force_encoding(Encoding::UTF_8)
end