[issue12931] xmlrpclib confuses unicode and string
Ulrich Seidl ulrich.se...@muneda.com added the comment: The change set committed for 2.7 introduces another problem. At the beginning of xmlrpclib.py, there is an explicit test for the availability of unicode: try: unicode except NameError: unicode = None # unicode support not available In case unicode was set to None, a TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and types will be raised by the code introduced to ServerProxy: if isinstance(uri, unicode): uri = uri.encode('ISO-8859-1') -- nosy: +uis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12931 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12931] xmlrpclib confuses unicode and string
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset c02e790c4535 by Victor Stinner in branch '2.7': Issue #12931: xmlrpclib now encodes Unicode URI to ISO-8859-1, instead of http://hg.python.org/cpython/rev/c02e790c4535 New changeset 5ceab07bcd02 by Victor Stinner in branch '3.2': Issue #12931: Add a test with Unicode URI to test_xmlrpc http://hg.python.org/cpython/rev/5ceab07bcd02 New changeset 3b46f2e2d280 by Victor Stinner in branch 'default': Merge 3.2: Issue #12931: Add a test with Unicode URI to test_xmlrpc http://hg.python.org/cpython/rev/3b46f2e2d280 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12931 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12931] xmlrpclib confuses unicode and string
Changes by STINNER Victor victor.stin...@haypocalc.com: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12931 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12931] xmlrpclib confuses unicode and string
Changes by Ezio Melotti ezio.melo...@gmail.com: -- stage: - committed/rejected ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12931 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12931] xmlrpclib confuses unicode and string
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti versions: -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12931 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12931] xmlrpclib confuses unicode and string
New submission from Wolfgang Schnerring wosc+pyt...@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 rep...@bugs.python.org http://bugs.python.org/issue12931 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12931] xmlrpclib confuses unicode and string
STINNER Victor victor.stin...@haypocalc.com added the comment: (thus failing, as #7093 tells, which I personally wouldn't have closed wontfix). I don't know the right encoding to encode a HTTP header. In Python 3, http.client.HTTPConnection.putheader() encodes header name to ASCII and header values to ISO-8859-1. -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12931 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12931] xmlrpclib confuses unicode and string
STINNER Victor victor.stin...@haypocalc.com added the comment: New patch using ISO-8859-1 instead of the default encoding (ASCII). -- keywords: +patch Added file: http://bugs.python.org/file23114/xmlrpclib_unicode_host-2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12931 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12931] xmlrpclib confuses unicode and string
Wolfgang Schnerring wosc+pyt...@wosc.de added the comment: I guess it should use the configured encoding[1] (which is utf-8 by default) to do that, shouldn't it? Since that's the encoding that is used for the message body, too. [1] http://docs.python.org/library/xmlrpclib.html#xmlrpclib.ServerProxy -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12931 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12931] xmlrpclib confuses unicode and string
STINNER Victor victor.stin...@haypocalc.com added the comment: I guess it should use the configured encoding[1] (which is utf-8 by default) to do that, shouldn't it? Since that's the encoding that is used for the message body, too. The URI is only used in HTTP headers, not in the body. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12931 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com