class HTTParty::TextEncoder

def encode_with_ruby_encoding

def encode_with_ruby_encoding
  # NOTE: This will raise an argument error if the
  # charset does not exist
  encoding = Encoding.find(charset)
  text.force_encoding(encoding.to_s)
rescue ArgumentError
  text
end