fix encoding issues on ruby 2.x