[s-xml-rpc-devel] bug: S-XML-RPC sends unencoded strings with invalid characters

Sven Van Caekenberghe scaekenberghe at common-lisp.net
Fri Jul 28 18:49:26 UTC 2006


On 28 Jul 2006, at 18:10, Taylor R Campbell wrote:

> S-XML:PRINT-STRING-XML does do certain escaping, but some code points
> are invalid even if escaped as entity references.  The particular
> problem I had was that lisppaste was sending me the contents of a
> paste with an ASCII form feed character, i.e. U+0C, which is not
> allowed in well-formed XML, even as an entity reference -- that is,
> the XML specification forbids .  To get around this, any XML-RPC
> message containing such a character (or any character below U+0C that
> is not U+09, U+0A, or U+0D) must be base64-encoded first.
>
> CL-USER> (s-xml:print-xml-string (string (code-char #x0C)))
> ""
> CL-USER> (s-xml-rpc::encode-xml-rpc-value (string (code-char #x0C)) t)
> <value><string>&#xC;</string></value>
> "</value>"
> CL-USER>
>
> S-XML:PRINT-XML-STRING should signal an error if any such characters
> are encountered, and S-XML-RPC::ENCODE-XML-RPC-VALUE should instead
> base64-encode the string and generate this output:
>
> <value><base64>DA==</base64></value>

Where exactly in the XML-RPC spec does it say this ? I never saw  
something like that.
 From my point of view, the XML-RPC spec is softer and more down to  
earth than others.
This is both a strong as well as a weak point. I also find their use  
of XML as being simplified as well.

If what you say is correct (and it looks that way), then I like XML  
even less than before ;-)
This would make any serialization of string overly complex, for any  
language or encoding.
Applying this change would kill some of my code is border cases.
Maybe we could add something like a 'strict' flag to toggle the  
behavior you suggest.

Sven




More information about the S-xml-rpc-devel mailing list