[New-bugs-announce] [issue7093] xmlrpclib.ServerProxy() doesn't support unicode uri

STINNER Victor report at bugs.python.org
Fri Oct 9 16:55:47 CEST 2009

New submission from STINNER Victor <victor.stinner at haypocalc.com>:

I backported xmlrpclib from Python trunk to Python 2.5 to get "connected
socket" (HTTP/1.1), which implies to backport also httplib, ssl and socket. It
works well. It's *much* faster, eg. 960 ms => 70 ms with HTTPS over a VPN.

I just have a little issue: if ServerProxy() URI is an unicode string and an
argument is an unicode string (with at least one non-ASCII character), the
request fails with:

  File ".../SVN/python-trunk/Lib/httplib.py", line 784, in _send_output
    msg += message_body
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 320:
ordinal not in range(128)

Attached patch includes a test.

Can uri contains a login and/or pasword? If yes, should it be encoded to UTF-8
(instead of ASCII)?

components: Library (Lib)
files: xmlrpclib_unicode_host.patch
keywords: patch
messages: 93798
nosy: haypo
severity: normal
status: open
title: xmlrpclib.ServerProxy() doesn't support unicode uri
versions: Python 2.6, Python 2.7
Added file: http://bugs.python.org/file15093/xmlrpclib_unicode_host.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list