[Zope] XML-RPC weirdness...
Sidnei da Silva
sidnei@x3ng.com.br
Fri, 2 Aug 2002 11:55:10 -0300
--------------Boundary-00=_YF181S5YPRRT6OYA43FR
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
Im trying to fetch a string via XML-RPC from Zope (into Flash) and some
characters are being encoded in a way that isnt understandable by my client
library.
I tried using python to do the same task, and then realized that the problem
may be that Zope isnt setting the right encoding when spitting out XML
responses.
Attached is the log of my failed test.
[]'s
PS: JFD, i tried replacing Zope's xmlrpclib with python2.2 one and got the
same error (altough a different traceback).
--
Sidnei da Silva (dreamcatcher) <sidnei@x3ng.com.br>
X3ng Web Technology <http://www.x3ng.com.br>
GNU/Linux user 257852
Debian GNU/Linux 3.0 (Sid) 2.4.18 ppc
Logic doesn't apply to the real world.
-- Marvin Minsky
--------------Boundary-00=_YF181S5YPRRT6OYA43FR
Content-Type: text/x-log;
charset="iso-8859-1";
name="xmlrpc.log"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="xmlrpc.log"
sidnei@hahalua:~/Zope/Zope/lib/python$ python
Python 2.1.3 (#1, Jul 30 2002, 01:26:06)
[GCC 2.95.4 20011002 (Debian prerelease)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> import xmlrpclib
>>> print xmlrpclib.__version__
0.9.9
>>> s=xmlrpclib.Server('http://localhost', verbose=1)
>>> print s.xmltest()
connect: (localhost, 80)
send: 'POST /RPC2 HTTP/1.0\r\n'
send: 'Host: localhost\r\n'
send: 'User-Agent: xmlrpclib.py/0.9.9 (by www.pythonware.com)\r\n'
send: 'Content-Type: text/xml\r\n'
send: 'Content-Length: 101\r\n'
send: '\r\n'
send: "<?xml version='1.0'?>\n<methodCall>\n<methodName>xmltest</methodName>\n<params>\n</params>\n</methodCall>\n"
reply: 'HTTP/1.1 200 OK\r\n
header: Date: Fri, 02 Aug 2002 14:36:32 GMT
header: Server: Zope/(Zope 2.5.1 (source release, python 2.1, linux2), python 2.1.3, linux2) ZServer/1.1b1
header: Content-Type: text/xml
header: Etag:
header: Content-Length: 200
header: X-Cache: MISS from sidnei.intranet.x3ng
header: Connection: close
body: "<?xml version='1.0'?>\n<methodResponse>\n<params>\n<param>\n<value><array><data>\n<value><string>Meu cora\xe7\xe3o, n\xe3o sei por que.</string></value>\n</data></array></value>\n</param>\n</params>\n</methodResponse>\n"
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "xmlrpclib.py", line 666, in __call__
return self.__send(self.__name, args)
File "xmlrpclib.py", line 815, in __request
verbose=self.__verbose
File "xmlrpclib.py", line 698, in request
return self.parse_response(h.getfile())
File "xmlrpclib.py", line 732, in parse_response
p.feed(response)
File "/usr/lib/python2.1/xmllib.py", line 168, in feed
self.goahead(0)
File "/usr/lib/python2.1/xmllib.py", line 284, in goahead
k = self.parse_endtag(i)
File "/usr/lib/python2.1/xmllib.py", line 697, in parse_endtag
self.finish_endtag(tag)
File "/usr/lib/python2.1/xmllib.py", line 732, in finish_endtag
self.unknown_endtag(nstag)
File "xmlrpclib.py", line 477, in end
return f(self)
File "xmlrpclib.py", line 507, in end_string
data = _decode(data, self._encoding)
File "xmlrpclib.py", line 108, in _decode
data = unicode(data, encoding)
UnicodeError: UTF-8 decoding error: invalid data
>>>
--------------Boundary-00=_YF181S5YPRRT6OYA43FR--