[New-bugs-announce] [issue12931] xmlrpclib confuses unicode and string

Wolfgang Schnerring report at bugs.python.org
Wed Sep 7 16:30:07 CEST 2011


New submission from Wolfgang Schnerring <wosc+python at wosc.de>:

This is a similar issue to http://bugs.python.org/issue7093, but more insiduous:

This works:

xmlrpclib.ServerProxy(u'http://localhost:8080').foo(dict(baz=u'bär'))

While this fails with a UnicodeDecodeError (note the trailing slash in the URI):

xmlrpclib.ServerProxy(u'http://localhost:8080/').foo(dict(baz=u'bär'))

  File "/usr/local/python2.7/lib/python2.7/httplib.py", line 937, in endheaders
    self._send_output(message_body)
  File "/usr/local/python2.7/lib/python2.7/httplib.py", line 795, in _send_output
    msg += message_body
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 139: ordinal not in range(128)


So, somewhere in xmlrpclib, confusion happens, since even though the URI is passed in as unicode both times, it is stored as string in the first case (thus compatible with the serialized, utf-8 encoded string of the message body), but in the second case it remains unicode (thus failing, as #7093 tells, which I personally wouldn't have closed wontfix).

----------
components: Library (Lib)
messages: 143680
nosy: wosc
priority: normal
severity: normal
status: open
title: xmlrpclib confuses unicode and string
type: behavior
versions: Python 2.6, Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12931>
_______________________________________


More information about the New-bugs-announce mailing list