Ruby 1.9 support for utf-8 encoder

This is a work in progress. Attempting to get all the tests passing in ruby 1.9