简体   繁体   中英

UTF-8 Encoding Error Ruby on Rails

I'm running into a UTF-8 issue with my rails application, which I recently took over from a different developer. While I known what the error means, and I know I need to force everything to UTF-8, but no luck. I've tried scrubbing through the application directory and updating all .rb files to UTF-8 (worked on a different app before).

I've also read through the different posts ( here and here for example) on UTF-8 issues with ruby to no luck.

When I run bundle update or any other bundle action, I get the following: ~/my_app/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler.rb:285:in 'split': invalid byte sequence in UTF-8

with additional errors below for the bundler.

When I try to run rails s I get:

    /.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler.rb:285:in 'split': invalid byte sequence in UTF-8 (ArgumentError)

    from ~/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/setup.rb:7:in `<top (required)>'
    from ~/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:116:in `require'
    from ~/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:116:in `rescue in require'
    from ~/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:122:in `require'
    from ~/Development/gorefi/gorefi/config/boot.rb:6:in `<top (required)>'
    from ~/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in `require'
    from /Users/gorefi/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in `require'

UPDATE

I tried to create a new app and ran into this error, which is definitely related. Not sure at all what's going on now!

ArgumentError: invalid byte sequence in UTF-8
An error occurred while installing rake (10.1.0), and Bundler cannot continue.
Make sure that `gem install rake -v '10.1.0'` succeeds before bundling.

Line 285 in bundler.rb is:

path = ENV['PATH'].split(File::PATH_SEPARATOR).find do |p|

So it is likely that you have something in your path that bundler is not expecting. I suggest you echo the path, see if it is something you can do without for a short while, and if so, set the environment variable to not contain whatever is causing the problem.

Longer term answer will depend on what the path data is. However, the chances are if this is a new install you are debugging, that this is just one more hurdle, and something else will crop up. You will want to create a list of things to fix properly once you have a handle on running the app in the first place.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM