Rails: Invalid byte sequence in US-ASCII (Argument Error) when I run rake db:seed
You're receiving an encoding error because your filesystem isn't configured to encode the date you've added (since presumably it includes new characters – possibly in your HTML entity encoded map URL – that didn't exist in your prior data seed).
The following will should resolve this error by setting the UTF-8 locale on your machine:
# from your command line
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
bundle
The benefit of setting a system locale is that all gems (going forward) will be bundled using UTF-8 encoding.
EDIT:
Alternatively, if you don't want to change your system encoding, you can set your encoding project-wide by specifying an encoding standard in your Gemfile:
if RUBY_VERSION =~ /1.9/ # assuming you're running Ruby ~1.9
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
end
Add
#encoding: utf-8
at the top of the file
You can also try export RUBYOPT="-KU -E utf-8:utf-8"
as mentioned in this GH thread