Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I input multibyte characters in rails console (or irb)?

Tags:

ruby

irb

guys. I am developing a Chinese application with rails. Now I want to input some Chinese characters in rails console but cannot do that, either in irb.

Any guys who have the experience to solve this problem? I would appreciate your help!

like image 261
Jimmy Huang Avatar asked Jan 04 '11 04:01

Jimmy Huang


1 Answers

Based on @Jimmy-Huang's answer, these are the steps I followed on Mac Leopard using rvm and ruby 1.9.2:

rvm package install readline
rvm remove 1.9.2
rvm install 1.9.2 --with-readline-dir=$rvm_path/usr

That resulted in some errors, particularly when trying bundle install:

uninitialized constant Gem::SilentUI

It turned out that's due to an older version of bundler and this gets rid of it:

gem install bundler
like image 142
Sjors Provoost Avatar answered Sep 24 '22 02:09

Sjors Provoost