does xmllib support non-UTF-8 charsets?
Skip Montanaro
skip at pobox.com
Tue Jul 24 09:43:25 EDT 2001
I'm using xmlrpclib 0.9.9 (similar to what will ship with 2.2 I think). The
database on the server contains a fair bit of Latin-1 stuff, mostly in the
form of European surnames, cities and addresses. After updating to 2.1 on
my development machine I was left with only the xmllib-based
xmlrpclib.SlowParser class because I hadn't yet installed sgmlop in my 2.1
tree.
I was getting tracebacks like this
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/local/lib/python2.1/site-packages/xmlrpclib.py", line 569, in __call__
return self.__send(self.__name, args)
File "/usr/local/lib/python2.1/site-packages/xmlrpclib.py", line 683, in __request
if transport is None:
File "/usr/local/lib/python2.1/site-packages/xmlrpclib.py", line 607, in request
headers
File "/usr/local/lib/python2.1/site-packages/xmlrpclib.py", line 641, in parse_response_gzip
File "/usr/local/lib/python2.1/xmllib.py", line 168, in feed
self.goahead(0)
File "/usr/local/lib/python2.1/xmllib.py", line 264, in goahead
self.syntax_error('illegal character in content')
File "/usr/local/lib/python2.1/xmllib.py", line 794, in syntax_error
raise Error('Syntax error at line %d: %s' % (self.lineno, message))
xmllib.Error: Syntax error at line 1472: illegal character in content
However, on the server end, it was generating xml that begins with
<?xml version='1.0' encoding='ISO-8859-1' ?>
<methodResponse>
<params>
<param>
<value><array><data>
<value><int>20</int></value>
<value><array><data>
<value><array><data>
<value><string>MusicEntry</string></value>
<value><struct>
<member>
It appears that xmllib is not paying attention to the encoding attribute. I
realize this is a deprecated module. Still, is this behavior expected?
--
Skip Montanaro (skip at pobox.com)
http://www.mojam.com/
http://www.musi-cal.com/
More information about the Python-list
mailing list