4

I have two macs, from one I can merrily type all the emoji I please into irb, pry, and so forth and deal with them just like any other string.

From a newer Mac that may have a few less custom encoding configurations, I cannot do this, and I'm unsure as to why.

$ ruby -v
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin14.0]

Here's an animated GIF of the issue:

irb escaping emoji as unicode bytes

And here's an animated GIF of irb working normally:

enter image description here

Any ideas on how to resolve this? I'm not an expert in Ruby's encoding settings (UTF, etc).

Justin Searls
  • 4,789
  • 4
  • 45
  • 56

1 Answers1

0

Make sure Ruby is compiled with GNU Readline. When rvm compiles Ruby it automatically checks if Readline is installed, and if it is it will be included automatically.

You can check your Readline version in irb. Example:

ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-linux]
irb(main):001:0> Readline::VERSION
=> "6.3"

So, copying your solution for installing the latest Readline with Homebrew, and then recompiling Ruby:

brew update; brew uninstall readline; brew install readline; rbenv install
Casper
  • 33,403
  • 4
  • 84
  • 79