I would like to send back from a xml-rpc python server german umlaute(ä,ö, ü, ..) inside a list to Zope but I always get a parser error(it's obviously not a Zope problem). I've read that I can send back unicode encoded strings but how do I do it? Thanks.
If you report an error then *please* give a detailed description including the traceback. -aj --On Dienstag, 14. Oktober 2003 23:03 Uhr +0200 Sven Hohage <hohage@muenster.de> wrote:
I would like to send back from a xml-rpc python server german umlaute(ä,ö, ü, ..) inside a list to Zope but I always get a parser error(it's obviously not a Zope problem). I've read that I can send back unicode encoded strings but how do I do it? Thanks.
I use xml_encode in an External Method to encode data being returned from a xmlrpc call: --------- #external method xml_encode.py from xmlrpclib import Binary def xml_encode(self,somestring): return Binary(somestring) --------- On the 'receiving' end you access the 'data' attribute of the returned object: i.e. ---- server = xmlrpclib.Server('http://somesite.com/') #getEncodedString returns result of xml_encode somestring=server.getEncodedString() thestring=somestring.data Mark Sven Hohage wrote:
I would like to send back from a xml-rpc python server german umlaute(ä,ö, ü, ..) inside a list to Zope but I always get a parser error(it's obviously not a Zope problem). I've read that I can send back unicode encoded strings but how do I do it? Thanks.
------------------------------------------------------------------------
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
On Tuesday 14 October 2003 22:03, Sven Hohage wrote:
I would like to send back from a xml-rpc python server german umlaute(ä,ö, ü, ..) inside a list to Zope but I always get a parser error(it's obviously not a Zope problem). I've read that I can send back unicode encoded strings but how do I do it? Thanks.
The smallest change would be.... def my_method(self): return self.string_containing_umlaute ....into.... def my_method(self): return unicode(self.string_containing_umlaute,'latin-1') Converting to unicode before output will work, but IMO its not the best approach. My recommendation is to always *store* language string as unicode type. -- Toby Dickenson
participants (4)
-
Andreas Jung -
Mark Gibson -
Sven Hohage -
Toby Dickenson