[issue1410] BaseHTTPServer cannot accept Unicode data
Christian Heimes
report at bugs.python.org
Fri Nov 9 22:08:46 CET 2007
Christian Heimes added the comment:
Yes, it's possible to send UTF-8 data:
>>> data = u"testdata umlaut öäü".encode("utf-8")
>>> data
'testdata umlaut \xc3\xb6\xc3\xa4\xc3\xbc'
>>> type(data)
<type 'str'>
>>> data == str(data)
True
>>> data is str(data)
True
You have to encode your unicode string to a byte string.
u''.encode(encoding) always returns a string. str() on a string doesn't
alter a string. As you can clearly see it's a NOOP (no operation).
__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1410>
__________________________________
More information about the Python-bugs-list
mailing list