Ruby Forum Rails I18n > no unicode in rails console

Posted by Brad Carson (carsonb)
on 13.02.2008 04:32
I'm unable to enter characters like é (in Café) into script/console but
they work just fine in the regular terminal.  I can't seem to find
anyone ever having an issue with this out there.

I'd be so grateful for any ideas.

# in config/environment.rb
ENV['LANG']  # => 'en_US.UTF-8'
ENV['LC_CTYPE'] # => 'en_US.UTF-8'

# from terminal:
# locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL="en_US.UTF-8"

System config:
Rails 2.0.2
Ruby 1.8
Mac OS X Leopard

Regards,
Brad
Posted by Izidor Jerebic (Guest)
on 25.02.2008 15:59
(Received via mailing list)
Just to confirm - I could not enter anything outside ASCII either. It
seems that the irb (which is used by script/console) input code is a
bit dumb...

I forgot exact solution but I thing I did something like simple
redirection with pipe 'cat | irb' or 'cat | script/console' and I
could enter the characters....

izidor
Posted by Brad Carson (carsonb)
on 25.02.2008 16:17
Izidor Jerebic wrote:
> Just to confirm - I could not enter anything outside ASCII either. It
> seems that the irb (which is used by script/console) input code is a
> bit dumb...
> 
> I forgot exact solution but I thing I did something like simple
> redirection with pipe 'cat | irb' or 'cat | script/console' and I
> could enter the characters....
> 
> izidor

Interesting.  I was eventually able to get it working by following these 
steps: http://www.macosxhints.com/article.php?story=20060825071728278

Hopefully this will help someone in a similar situation.  Thank you for 
responding.

Brad
Posted by Jerome Jj (yayel)
on 25.02.2008 17:36
(Received via mailing list)
On Wed, Feb 13, 2008 at 4:32 AM, Brad Carson <brad.carson@gmail.com> 
wrote:
> I'm unable to enter characters like é (in Café) into script/console but
>  they work just fine in the regular terminal.  I can't seem to find
>  anyone ever having an issue with this out there.


The input is not related to rails but to your terminal itself. Make
sure you also set "Unicode" in Preferences > Settings > Advanced tab >
International.

Hoping it will fix your issue.
Posted by John Ruby (satyadasa)
on 27.02.2008 16:49
Brad Carson wrote:
> Izidor Jerebic wrote:
>> Just to confirm - I could not enter anything outside ASCII either. It
>> seems that the irb (which is used by script/console) input code is a
>> bit dumb...
>> 
>> I forgot exact solution but I thing I did something like simple
>> redirection with pipe 'cat | irb' or 'cat | script/console' and I
>> could enter the characters....
>> 
>> izidor
> 
> Interesting.  I was eventually able to get it working by following these 
> steps: http://www.macosxhints.com/article.php?story=20060825071728278
> 
> Hopefully this will help someone in a similar situation.  Thank you for 
> responding.
> 
> Brad

I have the same problem and followed the steps at macosxhints regarding 
.profile, .inputrc, and .MacOSX/environment.plist, but it still doesn't 
work.  I'm using Leopard 10.5.2, Ruby 1.8.6., Rails 2.0.2.
Posted by Allan L. (allanium)
on 29.04.2008 18:28
Brad Carson wrote:
> I'm unable to enter characters like é (in Café) into script/console but
> they work just fine in the regular terminal.  I can't seem to find
> anyone ever having an issue with this out there.
> 


Would this help? - http://henrik.nyh.se/2008/03/irb-readline

According to the blog author, "The irb (Interactive Ruby) that ships 
with OS X Leopard does not have readline support.... More importantly to 
me, you can't use non-ASCII characters like Swedish 'å', 'ä' and 'ö'."

I haven't tried his solution yet, but I think this is what you (and I) 
are probably looking for (since I'm unable to type Japanese words into 
irb).