Hi to all!

I'm having troubles to make my XMLRPC application working with non
ASCII characters.


1.- In one terminal run the following script:

-----------XMLRPC Server-------------
import SimpleXMLRPCServer

server = SimpleXMLRPCServer.SimpleXMLRPCServer(("localhost",8003))
def test():
return "Test with the non ascii character '?'"

-----------XMLRPC Server-------------

2.- In a second terminal run this:

-----------XMLRPC Client-------------
import xmlrpclib

server = xmlrpclib.Server(("localhost", 8003))

-----------XMLRPC Client-------------

When you runs the XMLRPC Client script the following error is raised:

Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.3/xmlrpclib.py", line 1032, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.3/xmlrpclib.py", line 1319, in __request
File "/usr/lib/python2.3/xmlrpclib.py", line 1083, in request
return self._parse_response(h.getfile(), sock)
File "/usr/lib/python2.3/xmlrpclib.py", line 1217, in _parse_response
File "/usr/lib/python2.3/xmlrpclib.py", line 528, in feed
self._parser.Parse(data, 0)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 5,
column 50

Any ideas of what can I do?

Joxean Koret
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Esta parte del mensaje =?ISO-8859-1?Q?está?= firmada
Url : http://mail.python.org/pipermail/python-list/attachments/20050629/cd3bbf12/attachment.pgp

Search Discussions

  • Fredrik Lundh at Jun 29, 2005 at 1:15 pm

    Joxean Koret wrote:

    I'm having troubles to make my XMLRPC application working with non
    ASCII characters.
    you cannot just pass in 8-bit strings in arbitrary encodings and expect the XML-
    RPC layer to automagically figure out what you're doing.

    you can either use the encoding option to the ServerProxy constructor to tell
    the proxy what encoding to assume for 8-bit strings:

    proxy = ServerProxy(uri, encoding="iso-8859-1")



    for details)

    or you can do things the right way and use Unicode strings for non-ASCII text.

  • Richard Brodie at Jun 29, 2005 at 1:24 pm
    "Joxean Koret" <joxeankoret at yahoo.es> wrote in message
    news:mailman.1057.1120050564.10512.python-list at python.org...
    I'm having troubles to make my XMLRPC application working with non
    ASCII characters.
    I don't think XMLRPC has a mechanism for specifying an encoding other
    than UTF-8 (and that only by default). If you recode to that, you'll
    probably be OK.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
postedJun 29, '05 at 1:15p
activeJun 29, '05 at 1:24p



site design / logo © 2022 Grokbase