{"id":990,"date":"2010-05-05T14:14:44","date_gmt":"2010-05-05T17:14:44","guid":{"rendered":"http:\/\/blog.plataformatec.com.br\/?p=990"},"modified":"2010-05-05T14:14:44","modified_gmt":"2010-05-05T17:14:44","slug":"accented-chars-in-irb-with-rvm-and-ruby-1-8-7","status":"publish","type":"post","link":"https:\/\/blog.plataformatec.com.br\/2010\/05\/accented-chars-in-irb-with-rvm-and-ruby-1-8-7\/","title":{"rendered":"Accented chars in IRB with RVM and ruby 1.8.7"},"content":{"rendered":"
Since moving to Mac, I always find it surprising that the default Mac OS X Ruby and IRB doesn’t allow inputs with accented characters. So, you cannot do<\/p>\n
\r\nname = \"George Guimar\u00e3es\"\r\n<\/pre>\nThis is annoying for brazilians and anyone who uses non-ASCII characters. The problem is that the default Ruby in Mac OS X isn’t linked against readline. A simple solution is to compile readline on your system, and then compile your own ruby binaries. A better one is to use tools that automate this process. <\/p>\n
This post by Christopher Sexton<\/a> uses homebrew to compile readline-0.6 but compiles ruby by hand. Since we love RVM<\/a>, we’ll use it too.<\/p>\nIf you use Homebrew<\/a> (and you *should*), just do<\/p>\n\r\nbrew install readline\r\nbrew link readline\r\n<\/pre>\nBeware<\/strong>: linking readline into your system may break other tools that depends on readline source to compile. It was harmless on my system.<\/p>\nOk, so now we want to build a new ruby and irb binaries. I wanted to use ruby 1.8.7-p248, so:<\/p>\n
\r\nrvm install 1.8.7-p248 -C --enable-shared,--with-readline-dir=\/usr\/local\r\n<\/pre>\nThis tells the configure script to enable shared library linking (it is the default), and to search for readline in \/usr\/local<\/code> (homebrew has just linked readline there). You may have to use --force<\/code> if you already have this ruby version compiled. Newer versions of RVM do not need --force<\/code>.<\/p>\nNow you can use accented and unicode characters on keyboard input in IRB using ruby 1.8.7.<\/p>\n
And you? Do you have any tricks with IRB that you may want to share? Do you use Wirble<\/a>, Utility Belt<\/a> or others?<\/p>\n","protected":false},"excerpt":{"rendered":"Since moving to Mac, I always find it surprising that the default Mac OS X Ruby and IRB doesn’t allow inputs with accented characters. So, you cannot do name = “George Guimar\u00e3es” This is annoying for brazilians and anyone who uses non-ASCII characters. The problem is that the default Ruby in Mac OS X isn’t … \u00bb<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[1],"tags":[98,60,88,32],"aioseo_notices":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/posts\/990"}],"collection":[{"href":"https:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/comments?post=990"}],"version-history":[{"count":12,"href":"https:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/posts\/990\/revisions"}],"predecessor-version":[{"id":1002,"href":"https:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/posts\/990\/revisions\/1002"}],"wp:attachment":[{"href":"https:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/media?parent=990"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/categories?post=990"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/tags?post=990"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}