[Zope-dev] xmlrpc: Syntax error at line 34: illegal character in
content
Shane Hathaway
shane@digicool.com
Thu, 10 May 2001 21:05:57 -0400
richard@bizarsoftware.com.au wrote:
>
> Andy McKay wrote:
> >
> > > Yeah, I am currently base64'ing the data, and it works.
> >
> > Ive seen this in some code but didnt want to say anything for fear of
> > sounding stupid. It doesnt seem right somehow.
>
> See, this is the problem. I'm running into crunch-time at the moment, and I
> really don't have time to check the validity of third-party xmlrpc code. I
> honestly don't know if it's valid to send arbitrary binary data in an
> xmlrpc transaction.
Interestingly, it looks like xmlrpclib.py can *receive* base64-encoded
data automagically, but it never *sends* it. ppml.py, found in
Zope2/lib/python/Shared/DC/xml, has a convert() method which could serve
as a guide for making a patch to xmlrpclib that will enable it to
automatically encode in base64 when appropriate.
The problem with sending binary data unencoded is line endings: \r\n
might be "helpfully" converted to \n and vice-versa. Other characters
can be encoded but apparently parsers treat and as a
real line ending.
In fact it's time to convert xmlrpclib to use the Expat module (via SAX)
in Python 2.1. It should speed it up dramatically.
Shane