Fix encoding
Encode only for Ruby >= 1.9