Re: Marshaling unicode WDDX
isthar wrote: > Ok. but how I suppose to use them. I am currently using marshaller > indirectly via wddx.dump(). Do UWDDXMarshaller().dump() Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: Marshaling unicode WDDX
Ok. but how I suppose to use them. I am currently using marshaller indirectly via wddx.dump(). Anyway, thanks :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Marshaling unicode WDDX
isthar wrote: > WDDX is perfect for me for exchange between python and php application. > but maybe there is a better way to do it. It appears that Unicode objects where forgotten in the WDDX implementation. I suggest to define the following classes: class UWDDXMarshaller(xml.marshal.wddx.WDDXMarshaller): def m_unicode(self, data, dict): return self.m_string(data.encode("utf-8"), dict) class UWDDXUnmarshaller(xml.marshal.wddx.WDDXUnmarshaller): def um_end_string(self, name): ds = self.data_stack ds[-1] = u"".join(ds[-1]) self.accumulating_chars = 0 The m_unicode part should get integrated into PyXML; the um_end_string should probably return ASCII strings if possible, else Unicode strings. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: Marshaling unicode WDDX
"isthar" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi ! > i am trying to serialise object which contains some unicode objects > but looks like there is no way to do it. > hi, I'm sure you'll get better answers for the unicode part of your problem (I'd start with a look at the codecs module), but I wanted you to know that I'm using the wddx connection between Python and PHP with no problem. Here's the python code that writes a fairly complex data structure to the wddx file: def writeDocReport(self): from xml.marshal import wddx fileName = '%s/%s.doc.wddx' % (os.path.join(adsWeb,'jobs','wddx'), self.name) tmpFile = open(fileName,'wb') tmpFile.write(wddx.dumps(self.getDocData())) tmpFile.close() and the PHP: function getInputData($){ $file = "wddx/$prodName.wddx"; if (!is_file($file)) { exit("Report is not available for $prodName"); } $output = wddx_deserialize(file_get_contents($file)); -- http://mail.python.org/mailman/listinfo/python-list
Marshaling unicode WDDX
Hi ! i am trying to serialise object which contains some unicode objects but looks like there is no way to do it. File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/ _xmlplus/marshal/generic.py", line 92, in _marshal return getattr(self, meth)(value, dict) AttributeError: WDDXMarshaller instance has no attribute 'm_unicode' WDDX is perfect for me for exchange between python and php application. but maybe there is a better way to do it. Any clue? Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list