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.