Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails console invalid byte sequence in UTF-8 (ArgumentError)

I'm running ruby 2.0.0p247, rails 4.0.1 under rbenv management. When I first tried to start rails console, I had an error that readline is not found. I installed rb-readline gem and added to the gemfile as follows gem 'rb-readline', '0.4.2'. Adter bundle update the console became able to run. 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)

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.

I know that there are a lot of similar quastions here, but no luck with my configuration of rails/ruby so far. I'll appreciate any help, thanks in advance! Please pay attention to ruby/rails version before referring to other similar questions.

like image 214
Clergyman Avatar asked Nov 10 '22 16:11

Clergyman


1 Answers

I had the similar issue which was resolved by upgrading readline gem to 0.5.0 and setting it to false.

gem 'rb-readline', '~> 0.5.0', :require => false

(ruby 2.0.0-p481, rails 4.1.0, rbenv)
like image 79
spacerbot Avatar answered Dec 10 '22 05:12

spacerbot