[XML-SIG] Problem with wddx marshaller
Christian Scholz
cs at comlounge.net
Tue Jun 24 14:27:21 EDT 2003
Hi!
I am trying to read some data from a server in wddx format. This actually
fails because it contains umlauts which IMHO shouldn't fail as long as
the encoding is set right.
I tried the same with DOM and this parser reads it without problems.
Here is my failing test script:
-----------------------------------------------------------
from xml.marshal.wddx import loads
from xml.dom.minidom import parseString
from xml.dom.ext import PrettyPrint
s="""<?xml version="1.0" encoding="iso-8859-1" ?>
<wddxPacket version='1.0'>
<header></header>
<data>
<struct>
<var name='dummy'>
<string>dummyname</string>
</var>
<var name='name'>
<string>Gröhlkinder</string>
</var>
</struct>
</data>
</wddxPacket>"""
print "testing dom"
doc=parseString(s)
PrettyPrint(doc)
print "testing wddx"
print loads(s)
-----------------------------------------------------------
So the first call is successful and it gets pretty printed and
the loads() call is failing with:
Traceback (most recent call last):
File "./xmlbug.py", line 27, in ?
print loads(s)
File "/opt/Zope/python/213/lib/python2.1/site-packages/_xmlplus/marshal/wddx.py", line 272, in loads
return WDDXUnmarshaller().loads(string)
File "/opt/Zope/python/213/lib/python2.1/site-packages/_xmlplus/marshal/generic.py", line 321, in loads
return m._load(file)
File "/opt/Zope/python/213/lib/python2.1/site-packages/_xmlplus/marshal/generic.py", line 331, in _load
p.parseFile(file)
File "/opt/Zope/python/213/lib/python2.1/site-packages/_xmlplus/sax/drivers/drv_pyexpat.py", line 68, in parseFile
if self.parser.Parse(buf, 0) != 1:
File "/opt/Zope/python/213/lib/python2.1/site-packages/_xmlplus/sax/drivers/drv_pyexpat.py", line 49, in endElement
self.doc_handler.endElement(name)
File "/opt/Zope/python/213/lib/python2.1/site-packages/_xmlplus/marshal/generic.py", line 381, in endElement
em(name)
File "/opt/Zope/python/213/lib/python2.1/site-packages/_xmlplus/marshal/generic.py", line 409, in um_end_string
ds[-1] = str(string.join(ds[-1], ""))
UnicodeError: ASCII encoding error: ordinal not in range(128)
So is this a (maybe known) bug or am I doing something wrong?
(might fix it if I'd know where to start.. might look into this..)
FYI: PyXML 0.8.2 with Python 2.1.3 on linux is used.
regards,
Christian
--
COM.lounge http://comlounge.net/
communication & design info at comlounge.net
More information about the XML-SIG
mailing list