Ruby 1.9.3 :, UTF-8字符所需的gem无法解析,如何解决?

时间:2016-10-03 23:48:13

标签: ruby-on-rails encoding utf-8

我正在与这个堆栈跟踪作斗争并且还无法解决:

/home/user/.rvm/gems/ruby-1.9.3-p484/gems/bugsnag-5.0.1/lib/bugsnag/sidekiq.rb:1:in `require': /home/user/.rvm/gems/ruby-1.9.3-p484/gems/sidekiq-4.2.2/lib/sidekiq.rb:51: invalid multibyte char (US-ASCII) (SyntaxError) from /home/user/.rvm/gems/ruby-1.9.3-p484/gems/bugsnag-5.0.1/lib/bugsnag/sidekiq.rb:1:in `<top (required)>' from /home/user/.rvm/gems/ruby-1.9.3-p484/gems/bugsnag-5.0.1/lib/bugsnag.rb:135:in `require' from /home/user/.rvm/gems/ruby-1.9.3-p484/gems/bugsnag-5.0.1/lib/bugsnag.rb:135:in `block in <top (required)>' from /home/user/.rvm/gems/ruby-1.9.3-p484/gems/bugsnag-5.0.1/lib/bugsnag.rb:133:in `each' from /home/user/.rvm/gems/ruby-1.9.3-p484/gems/bugsnag-5.0.1/lib/bugsnag.rb:133:in `<top (required)>' from /home/user/.rvm/gems/ruby-1.9.3-p484/gems/bundler-1.12.5/lib/bundler/runtime.rb:86:in `require' 有问题的gem中的源文件包含一些UTF-8字符(def self.❨╯°□°❩╯︵┻━┻),但标有# encoding: utf-8

我知道Ruby中的编码问题只有一个&lt; 2.0但我无法升级。为什么在这里忽略编码头,我需要查找什么?

1 个答案:

答案 0 :(得分:0)

encoding:utf-8 - 有一个内部编码。如果需要,您还需要检查并设置外部编码。

用于设置它们都运行Ruby过程,如

ruby -E utf-8

ruby --encoding utf-8