xml-rpc UnicodeDecodeError

timothee cezard tcezard at staffmail.ed.ac.uk
Thu Jun 10 06:54:28 EDT 2010


Hi all,
I'm starting to use xml-rpc module to check and potentially modify a 
confluence wiki
but I'm getting and error on a page containing the pound (£) sign

here is the code I'm using

server = xmlrpclib.ServerProxy('my_server',  verbose=True)
token = server.confluence1.login('username','password)
page = server.confluence1.getPage(token, spacekey, pagetitle)
print page['content']
I'm getting:
    page = server.confluence1.getPage(token, spacekey, pagetitle)
   File "/usr/lib/python2.6/xmlrpclib.py", line 1199, in __call__
     return self.__send(self.__name, args)
   File "/usr/lib/python2.6/xmlrpclib.py", line 1489, in __request
     verbose=self.__verbose
   File "/usr/lib/python2.6/xmlrpclib.py", line 1253, in request
     return self._parse_response(h.getfile(), sock)
   File "/usr/lib/python2.6/xmlrpclib.py", line 1387, in _parse_response
     p.feed(response)
   File "/usr/lib/python2.6/xmlrpclib.py", line 868, in end
     return f(self, join(self._data, ""))
   File "/usr/lib/python2.6/xmlrpclib.py", line 959, in end_value
     self.end_string(data)
   File "/usr/lib/python2.6/xmlrpclib.py", line 916, in end_string
     data = _decode(data, self._encoding)
   File "/usr/lib/python2.6/xmlrpclib.py", line 164, in _decode
     data = unicode(data, encoding)
   UnicodeDecodeError: 'utf8' codec can't decode byte 0xa3 in position 
811: unexpected code byte


I tried changing the encoding to iso-8859-1
server = xmlrpclib.ServerProxy('my_server', encoding='iso-8859-1', 
verbose=True)
token = server.confluence1.login('username','password)
page = server.confluence1.getPage(token, spacekey, pagetitle)
print page['content']
I'm getting the same exception

Does any of you have an idea of what I'm doing wrong?
I'm using Python 2.6.4 (r264:75706, Dec  7 2009, 18:43:55) and xmlrpclib 
version 1.0.1

Thanks

Tim


-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.




More information about the Python-list mailing list