Check RUBY_VERSION to use force_encoding

Please apply this patch to work with Ruby 1.8.