Search code examples
rubymacosencodingutf-8irb

Can't enter Umlauts in Ruby 1.9.3 IRB


I am experiencing very strange behavior in Ruby 1.9.3's IRB with Mac OS 10.7.3 When I try to enter an Umlaut, it's escaped in the prompt and looks like this (I entered "ü" on the keyboard)

irb(main):001:0> "\U+FFC3\U+FFBC"

What's super strange is this:

irb(main):001:0> "\U+FFC3\U+FFBC".length
=> 0

Of course, the character isn't displayed either:

irb(main):001:0> "\U+FFC3\U+FFBC"
=> ""

Does anyone know what's going on here or how to fix this?


Solution

  • Victor Moroz didn't quite give the definitive answer but his link led me to a solution (thx!):

    I forgot to mention:

    What I then did to solve this problem in my case was to recompile, this time pointing ruby to a more recent version of readline (6.2.2 in my case) that I installed with homebrew.

    The steps it took were:

    $ brew install readline
    $ export CPPFLAGS=-I/usr/local/Cellar/readline/6.2.2/include
    $ export LDFLAGS=-L/usr/local/Cellar/readline/6.2.2/lib/
    $ curl https://raw.github.com/gist/1688857/rbenv.sh | sh && rbenv global 1.9.3-p125-perf