'StdioOnnaStick converts unicode prints to byte strings on Python 2, in
order to be compatible with the normal stdout/stderr objects.
On Python 3, the prints are left unmodified.'

def test_unicode(self):

    unicodeString = u'Hello,    \xbd    world.'
    stdio = log.StdioOnnaStick(encoding='utf-8')
    self.assertEqual(stdio.encoding, 'utf-8')
    stdio.write((unicodeString + u'\n'))
    stdio.writelines([(u'Also,    ' + unicodeString)])
    oldStdout = sys.stdout
    sys.stdout = stdio
    self.addCleanup(setattr, sys, 'stdout', oldStdout)
    print(unicodeString)
    if _PY3:
        self.assertEqual(self.getLogMessages(), [unicodeString, (u'Also,    ' + unicodeString), unicodeString])
    else:
        self.assertEqual(self.getLogMessages(), [unicodeString.encode('utf-8'), (u'Also,    ' + unicodeString).encode('utf-8'), unicodeString.encode('utf-8')])
