I had tried sending the the encoding object before, but it fails (takes the default encoding), only sending the string works. Checked in a couple of places ex: kernel/common/io19.rb