Are you on OS X?

I am using ruby-2.0.0-p195, and if I install it navely I see:

ratdog:tmp mike$ ./try.rb
? \U+FFE5\U+FFBA

0
ratdog:tmp mike$ rbenv version
2.0.0-p195 (set by /Users/mike/.rbenv/version)

If I re-install using the helpful hints at https://github.com/sstephenson/ruby-build/wiki (making sure I have the homebrew openssl and readline installed...)

ratdog:tmp mike$ env RUBY_CONFIGURE_OPTS=--with-openssl-dir=`brew --prefix openssl` CONFIGURE_OPTS=--with-readline-dir=`brew --prefix readline` rbenv install 2.0.0-p195
Downloading ruby-2.0.0-p195.tar.gz...
[...]
ratdog:tmp mike$ ./try.rb ? На
На
1
ratdog:tmp mike$ rbenv version
2.0.0-p195 (set by /Users/mike/.rbenv/version)

Hope this helps,

Mike

On 2013-06-30, at 5:06 AM, Bryan Lockwood <lockwood.bryan / mac.com> wrote:

> Here's my test program:
> ----------------------------------------------
> #!/usr/bin/env ruby
> 
> require 'readline'
> 
> ans = Readline.readline("? ", false)
> puts ans
> puts ans. length
> ----------------------------------------------
> and here's my test session with Ruby 1.9.2 and Ruby 1.9.3
> 
> 11:00 cards:>rvm use 1.9.2
> Using /Users/bryanloc/.rvm/gems/ruby-1.9.2-p320
> 11:00 cards:>./tester.rb 
> ? На
> На
> 1
> 11:00 cards:>rvm use 1.9.3
> Using /Users/bryanloc/.rvm/gems/ruby-1.9.3-p392
> 11:01 cards:>./tester.rb 
> ? \U+FFE5\U+FFBA
> 
> 0
> 
> 
> OK, am I doing something wrong, or do I need to do something special to get Chinese characters?
> A simple call of gets(), i.e. not using readline, works fine, and returns the Chinese character.
> 
> Thanks in advance,
> 
> Bryan
> 
> 
> 
> 

-- 

Mike Stok <mike / stok.ca>
http://www.stok.ca/~mike/

The "`Stok' disclaimers" apply.