Why Ruby on Rails isn’t ready for Ruby 1.9.x

Posted: September 21st, 2009 | Author: | Filed under: ruby, web | Tags: , | 2 Comments »

I’ve spend the better part of the last two weeks dealing with upgrading my operating system to Snow Leopard. Honestly, I haven’t seen much difference, but I believe that there is an improvement. Things just feel faster.

One of the big changes I was going to make was moving all my development to ruby 1.9.1, since it’s now the preferred ruby as stated by ruby-lang.org.

I was able to install it, add gems and such based on various tutorials I read on the net. My problem started as soon as I tried to deal with rails 2.3.4 and textmate. Time after time, I tried to run tests, and ended up with the same issue.

invalid multibyte character

Here’s a test for you. Fire up an irb shell using ruby 1.9.1.

irb
control      = %Q|\x00-\x1f\x7f-\xff|
CONTROL_CHAR  = /[#{control}]/n

The next thing you should see is:

ArgumentError: invalid multibyte character
	from (irb):2
	from /usr/local/bin/irb:12:in `<main>'

Those two lines are taken from actionmailer-2.3.4/lib/action_mailer/vendor/tmail-1.2.3/tmail/utils.rb:115-117

That’s the tmail-1.2.3 that’s vendored in the gems used for rails. A few searches on the net and you find:

http://github.com/mikel/tmail

The first line of text in the readme?
Note… as of 1.2.5, TMail is not compatible with Ruby 1.9.1.

Huh.

So, my guess is, anyone who’s using rails with ruby 1.9.1 has just been getting lucky up to this point. I was not so lucky, and that’s why I’ve moved back to ruby 1.8.7. I’m a lot happier right now.


2 Comments on “Why Ruby on Rails isn’t ready for Ruby 1.9.x”

  1. 1 Andreas said at 4:28 pm on September 21st, 2009:

    Hi
    i am running Ruby 1.9.x for a few months now. Had some issues, but now i can say, that everything i need works, including Rails.
    TMail is still an issue though. But help is on the way:
    http://isitruby19.com/tmail
    http://github.com/mikel/mail
    I think Rails is ready for Ruby 1.9 or will be soon. I don’t fully understand 1.9′s encoding superpowers yet, but your code snipped runs on my machine when run from a file, not in irb. In irb on Ruby trunk (1.9.2dev) i get “RegexpError: /…/n has a non escaped non ASCII character in non ASCII-8BIT script”.

  2. 2 Derrick said at 5:18 pm on April 23rd, 2010:

    I know I’m late to the party, but if you change

    %Q|\x00-\x1f\x7f-\xff|

    to

    %Q|\x00-\x1f\x7f-\xff|.force_encoding(“ASCII-8BIT”)

    it should start working.

    This is more so that when other people search they find a solution. Your page was the first one I read.


Leave a Reply