[python-win32] SimpleXMLRPCServer encoding issue

Ludovic Reenaers lreenaers at ressource-toi.org
Mon Jan 7 15:11:38 CET 2008


Hello,

I'm writing a small wxpython application, using SimpleXMLRPCServer for client/server communication. It works pretty fine and I XMLRPCServer is relly reliant. During unit test phase,I found a small problem that I can't face since I'm not well aware about encoding. Anyway here is the problem:

My client sends a string parameter through a XMLRPCserver remote methode call. the server process it and returns a result. The issue rise when I send a french character (I suppose it would be the same with any non conventional char like chines or whatever..) embeded within the string. for example "é" (but simple quote or "ç" crashes aswell). the exception raised is:

"""

  File "C:\Python25\Lib\site-packages\app\common\gui.py", line 31, in broadcastMsg
    c=self._srvConn.export_broadcastMsg(msg,hashid)
  File "C:\Python25\lib\xmlrpclib.py", line 1147, in __call__
    return self.__send(self.__name, args)
  File "C:\Python25\lib\xmlrpclib.py", line 1437, in __request
    verbose=self.__verbose
  File "C:\Python25\lib\xmlrpclib.py", line 1201, in request
    return self._parse_response(h.getfile(), sock)
  File "C:\Python25\lib\xmlrpclib.py", line 1340, in _parse_response
    return u.close()
  File "C:\Python25\lib\xmlrpclib.py", line 787, in close
    raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 1: "<class 'xml.parsers.expat.ExpatError'>:not well-formed (invalid token): line 6, column 15">

"""

I've been reading around and found that a "encoding" parameter could be set at SimpleXMLRPCServer level. The question I have here is: "What Damned encoding should I chosse in order to make my server as international language compliant as possible?"

Thanks in advance and sorry for my poor knowledge of english language,

Ludo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20080107/732a045b/attachment.htm 


More information about the python-win32 mailing list