I'm working on a rails API project. Here is my code snippets
class PeopleController < ApplicationController
respond_to :json
def index
respond_with Person.all
end
end
and when I visit the url localhost:3000/people.json
Encoding::UndefinedConversionError at /people.json "\xE7" from ASCII-8BIT to UTF-8
I'm trying to solve this issue since last week, but still fighting with this. I've found the bunch of similar question over stackoverflow such as this & this but non of the solution worked for me.
Here are the configuration I've.
Rails 4.2.7.1
ruby-2.3.1
Operating system: macOS Sierra
Output of locale
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL=
content on ~/.bash_profile
export LC_CTYPE="utf-8"
export LC_CTYPE=en_US.UTF-8
export LANG=en_US.UTF-8
unset LC_ALL
Output of Encoding.default_external
#<Encoding:UTF-8>