Add an unless valid_encoding? to the Ruby 1.9 implementation