[英]Rails console invalid byte sequence in UTF-8 (ArgumentError)
I'm running ruby 2.0.0p247, rails 4.0.1 under rbenv management. 我在rbenv管理下运行ruby 2.0.0p247,rails 4.0.1。 When I first tried to start rails console, I had an error that readline is not found.
当我第一次尝试启动rails控制台时,我遇到了一条未找到readline的错误。 I installed rb-readline gem and added to the gemfile as follows
gem 'rb-readline', '0.4.2'
. 我安装了rb-readline gem并添加到gemfile中,如下所示:gem'rb
gem 'rb-readline', '0.4.2'
。 Adter bundle update the console became able to run. Adter bundle更新控制台变得能够运行。 However, when I press upwards arrow to recall previous command, the console crashes with the following error:
但是,当我按向上箭头调用上一个命令时,控制台崩溃时出现以下错误:
/home/clergyman/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rb-readline-0.4.2/lib/rbreadline.rb:4269:in `block in _rl_dispatch_subseq': invalid byte sequence in UTF->8 (ArgumentError)
/home/clergyman/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rb-readline-0.4.2/lib/rbreadline.rb:4269:in,clock in _rl_dispatch_subseq' :UTF-> 8中的无效字节序列(ArgumentError)
A common solution to this is trying to bing 'rb-readline' gem of later version like 0.5.0, however if change the gem version this way, I cannot even start the console, it crashes as if readline is not installed. 一个常见的解决方案是尝试将更新版本的'rb-readline'宝石命名为0.5.0,但是如果以这种方式更改宝石版本,我甚至无法启动控制台,它会崩溃,就像没有安装readline一样。
I know that there are a lot of similar quastions here, but no luck with my configuration of rails/ruby so far. 我知道这里有很多类似的规则,但到目前为止我的rails / ruby配置没有运气。 I'll appreciate any help, thanks in advance!
我会感激任何帮助,提前谢谢! Please pay attention to ruby/rails version before referring to other similar questions.
在提到其他类似问题之前,请注意ruby / rails版本。
I had the similar issue which was resolved by upgrading readline gem to 0.5.0 and setting it to false. 我有类似的问题,通过将readline gem升级到0.5.0并将其设置为false来解决。
gem 'rb-readline', '~> 0.5.0', :require => false
(ruby 2.0.0-p481, rails 4.1.0, rbenv)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.