xmlrpclib and carriagereturn (\r)

Fredrik Lundh fredrik at pythonware.com
Sat Mar 18 02:54:49 EST 2006


Jonathan Ballet wrote:

> The problem is, xmlrpclib "eats" those carriage return characters when
> loading the XMLRPC request, and replace it by "\n". So I got "bla\n\nbla".
>
> When I sent back those parameters to others Windows clients (they are
> doing some kind of synchronisation throught the XMLRPC server), I send
> to them only "\n\n", which makes problems when rendering strings.
>
> It seems that XMLRPC spec doesn't propose to eat carriage return
> characters : (from http://www.xmlrpc.com/spec)

XMLRPC is XML, and XML normalizes line feeds:

    http://www.w3.org/TR/2004/REC-xml-20040204/#sec-line-ends

relying on non-standard line terminators in text is fragile and horridly out-
dated; if the data you're sending qualifies as text, send it as text, and do
the conversion at the end points (if at all necessary).

if it's not text, use the binary wrapper.

> I send to them only "\n\n", which makes problems when rendering strings.

how are you rendering things if you have problems treating a line feed
as a line feed?  that's rather unusual; most Windows applications have
no problems handling line feeds properly, so I'm not sure why it has to
be a problem in your application...

</F>






More information about the Python-list mailing list