I am making an API in a Rails application, but I am having some trouble with the encoding, so it seems. I am actually really unsure on what that actual error is. I have written a module, with two classes in. One of which is used to get some DNS records of a domain. When I instantiate the class by it self, and call a method it works just fine, however when I run it in my Rails app, I am being thrown an error saying `"\x90" from ASCII-8BIT to UTF-8`

This is a bit from my class

```
#
# Class initializer to set instance variable with domain
#
def initialize(domain)
  @domain = domain
end

#
# Generates hash to be used in other methods
# @returns a hash with usefull info and made ready for later input
#
def generate_hash
  hash = {
    'timestamp' => Time.now.to_i,
    'credits_remaining' => 123,
    'response' => {
      'domain' => @domain,
      'records' => {}
    }
  }
  return hash
end

#
# Get A Records for a domain
# @returns JSON formatted hash
# 
def get_a_records
  data = self.generate_hash
  Resolv::DNS.open do |dns|
    ress = dns.getresources @domain, Resolv::DNS::Resource::IN::A
    p = ress.map { |r| r.address }
    data['response']['records']['a'] = p
  end
  return data.to_json
end

```

And from my controller:

```
require 'domainapi'
class CallsController < ApplicationController

  def index
    render json: {'status': 'OK'}
  end

  def dns
    dns = DomainAPI::Dns.new(params[:domain])
    response = dns.get_a_records
    render json: response
  end

end

```

The index method in my class works just fine. I query my api like this `http://api.lvh.me:3000/v1/dns/a/stackoverflow.com`

The `lvh.me` domain is something I use, so that I can use subdomains locally.
Can someone see what might be the error, or have a suggestion to what I could do?

**Update**

I found out that trying out different domains, throws different errors.
google.com throws:
`"\xF2" from ASCII-8BIT to UTF-8`
facebook.com throws:
`"\xAD" from ASCII-8BIT to UTF-8`
rubyonrails.org thows:
`"\xC0" from ASCII-8BIT to UTF-8`