jruby/jruby — pull request #1699 by orikremer (2014-05-15 18:11:19+00:00)
Title: StringIO.set_encoding may change shared ByteList encoding

When creating a StringIO instance with no arguments, ptr.string references the shared EMPTY_BYTELISTS instance for that encoding.

It is possible to then call set_encoding to change the encoding on the shared instance.

This fix is to duplicate the value before changing the encoding.