"Tim Arnold" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm confused about why I get this error: > UnicodeError: ASCII encoding error: ordinal not in range(128) > > when I try to load a wddx file containing this string: > <string>The image file, gif/aperçu.png, does > not exist.</string> > > When I loop through the file as if it's text and check the ord() value of > each character, of course it's clean. Do I have to replace numbered > entities in the wddx file before I can wddx.load() it? > thanks! > --tim > > example program: > ------------------- > from xml.marshal import wddx > > datastring = '''<?xml version="1.0"?> > <!DOCTYPE wddxPacket SYSTEM "wddx_0090.dtd"> > <wddxPacket version="0.9"> > <header/> > <data><struct> > <string>The image file, gif/aperçu.png,does not exist.</string> > </struct></data></wddxPacket>''' > > data = wddx.loads(datastring)
Replying to my own post. I got around this problem, which *looks* like a bug to me, (although I'm sure I don't understand the internals of xml.marshal) with this: self.data = wddx.loads(''.join(codecs.open(self.filename, errors='ignore',encoding='ascii').readlines())) where self.filename contains the numbered entity. just in case anyone else out there is using wddx to communicate between python and php. --Tim Arnold -- http://mail.python.org/mailman/listinfo/python-list