Ruby 1.9 treats the encoding within each String instance. And there are rules which encoding are defined from script or from external file. The rules are there (in Japanese).
I think, CRuby is the one and only Ruby implementation treating this rules correctly. When I had used irb, I had found its bug in JRuby and in IronRuby, and have reported this for each projects. In JRuby, this bug will be fixed for v1.6 release.