-- Nick Lo <[EMAIL PROTECTED]> wrote
(on Saturday, 06 October 2007, 12:21 AM +1000):
> I'm trying to embed some html in a array returned from a function  
> that is used by Zend_Xml_Rpc_Server and having erratic results.  
> Sometimes it works and sometimes it doesn't but I'm not sure how to  
> specify the content in any way. For example in the example code I  
> tried things like htmlentities() or...
> 
> '<![CDATA[' . $content->body . ']]>',
> 
> ...but in many cases (particularly with tricky html) the description  
> ends up as an empty string.

Oof. I've never tried sending HTML back in my XML-RPC responses before.
The problem you run into, as you're noting, is that you're wrapping the
HTML in XML, which is always problematic -- you need to use entities, or
CDATA, and I'm not entirely sure XML-RPC will play well with CDATA
anyways.

Try base64-encoding the HTML. This will mean extra work on the receiving
end, but should make it safe enough to pass embedded in the XML-RPC
(which, I believe, may have been one of the rationale's behind having a
'base64' XML-RPC type in the first place).

-- 
Matthew Weier O'Phinney
PHP Developer            | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/

Reply via email to