OTWO-1213 Works around lost encoding in Ruby/C binding layer
When a Ruby 1.9.2 string is passed to the C code, the associated
encoding metadata is lost. When this same string is then returned from C
back to Ruby, an arbitrary, mismatched encoding is applied to replace
the lost one.
This means that a string becomes garbled in the round trip. The bits
don't change, but the encoding is lost.
The correct fix would be to preserve the encoding metadata in the C
layer.
The easier fix is to replace the lost encoding with a more likely match,
which is what I've done in this patch. When the C code returns a string,
we apply the Ruby runtime's current default encoding, which is highly likely to
be the encoding originally discarded.