From: Brian Candler Date: 2008-11-06T00:12:03+09:00 Subject: Re: irb and ruby giving different results Nit Khair wrote: > ENV.grep(/^LC/) show nothing in both irb and ruby My bad; try ENV.select{|k,v| k=~/^LC/} > ENV['LC_ALL']='C' 'POSIX' etc has no effect in both > > However, "echo $LC_ALL" on my prompt gives en_US.UTF-8. > So when i did LC_ALL='C', i get only 95 in both ruby and irb. > > Is there any way i get can ruby to also give 191 ? Perhaps then: env LC_ALL=en_US.UTF-8 ruby foo.rb Also, looking through source: it seems that ruby doesn't normally call setlocale() by itself, but maybe some third-party library which irb is invoking is doing this for you. "readline" is a likely candidate. So you could try: require 'readline' in your ruby file. Or check $LOADED_FEATURES in irb and try loading the same modules in your ruby file. -- Posted via http://www.ruby-forum.com/.