[Zope] xmlrpc and charsets

Toby Dickenson tdickenson at geminidataloggers.com
Wed Oct 15 07:07:49 EDT 2003


On Wednesday 15 October 2003 12:09, Gilles Lenfant wrote:

> # Client side (external method)
> charset = 'iso-8859-1'
> # Setting params
> a = unicode(a, charset)
> b = unicode(b, charset)
> # Making request
> server = xmlrpclib.Server("http://some.webservice.net/")
> resultstring = server.doStuff(a, b).encode(charset, 'replace')
>
> # Server side handler (TTW python script)
> ##parameters=a, b
> charset = 'utf-8'
> a = a.encode(charset, 'replace')
> b = b.encode(charset, 'replace')
> # Do the stuff
> ...
> return unicode(stuff, charset)

The above will work, but I really recommend (if possible) working with all 
those values as unicode in the rest of your program too, client and server 
side.

-- 
Toby Dickenson




More information about the Zope mailing list