Ruby 1.8.7 backwards compatibility for set_encoding