Fix Ruby version check and test.

Don't run encoding test in Ruby 1.8 or less.