First time using faraday, so I might be doing things incorrectly, but the response.body encoding in the following is ASCII-8BIT:
def self.search(term)
connection = Faraday.new(url: 'https://en.wikipedia.org')
response = connection.get do |req|
req.options = { :timeout => 5, :open_timeout => 3 }
req.url '/w/api.php' , action: 'opensearch', format: 'xml', search: term
end
puts response.body.encoding
end
In 1.9.2 this causes REXML to throw an Encoding::CompatibilityError.
I couldn't find a way to force faraday to provide response.body in UTF-8.
What is the preferred solution to this?
First time using faraday, so I might be doing things incorrectly, but the
response.bodyencoding in the following is ASCII-8BIT:In 1.9.2 this causes REXML to throw an
Encoding::CompatibilityError.I couldn't find a way to force faraday to provide
response.bodyin UTF-8.What is the preferred solution to this?