XML-RPC and cyrillic text in CP1251 and UTF-8
Currently I'm creating Control Panel for Zope site using Microsoft C#.NET which makes programs speaking in native 2-byte Unicode. Also I am using XMLRPC library for C#.NET which seem to function almost properly (almost or I haven't understood something). The problems are: 1. Zope doesn't accept single parametered function calls, only zero or two or more, single parameter calls always fail. 2. Zope doesn't like UTF8-encoded XML request with parameter values containing cyrillic text, I always get failure response from server, but Zope likes UTF8-encoded response and passes its content correctly back to my program. 3. Empty (string "") return value wasn't correctly recognised by XMLRPC library (this is not Zope issue) Workarounds found were: 1. Use second dummy parameter 2. Pack UTF8 cyrillic strings with BASE64 and unpack in receiving Zope method using base64 module and then decode to 1-byte CP1251 encoding using "encodings" module. 3. Use special response string value like "empty" or "none" which means "none" ;) The question is: Are there more straightforward methods to fix this or workarounds found are ok?
Dmitry Litovchenko writes:
... Zope XML-RPC ... The problems are:
1. Zope doesn't accept single parametered function calls, only zero or two or more, single parameter calls always fail. I did not (yet) try but I do not believe this:
It looks like the Python "single element tuple" caveat, maybe, somewhere in your application code.
2. Zope doesn't like UTF8-encoded XML request with parameter values containing cyrillic text, I always get failure response from server, but Zope likes UTF8-encoded response and passes its content correctly back to my program. Try "<?xml version="1.0" encoding="utf-8">". This XML declatation should be the default, but Zope's XML-RPC library might use "iso-8859-1" as default encoding.
Dieter
participants (2)
-
Dieter Maurer -
Dmitry Litovchenko