您的位置:首页 > 产品设计 > UI/UE

rails invalid byte sequence in US-ASCII

2016-05-11 00:00 435 查看
摘要: https://ruby-china.org/topics/25052 http://hearrain.com/2013/04/738 http://stackoverflow.com/questions/17031651/invalid-byte-sequence-in-us-ascii-argument-error-when-i-run-rake-dbseed-in-ra
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  US-ASCII