Fix handling of io.StringIO in unicode_output_stream.