Hey team,
I'm having a problem sending special characters out of my Flash client to PHP, via XML.
For example, I compile an input field that takes free text into an XML node, and send it to my PHP script. But in PHP, it breaks at any apostrophe when parsed, because the PHP parser is hitting &apos strings. The PHP returns any string data in a CDATA tag, and I handle those as usual.
However, if I try to compile a CDATA tag inside Flash to send back to PHP, naturally it just strips it out.
Here's a function I'm using to compile the XML:
ActionScript Code:
function makeCDataNode(nid,nname,nvalue) {
var nvalue = ("<![CDATA["+nvalue+"]]>")
var tXML = new XML("<selection><id>"+nid+"</id><fieldname>"+nname+"</fieldname><value>"+nvalue+"</value></selection>");
return tXML;
}
But no joy - Flash strips the CDATA tag when compiling, and we're left with &apos for any apostrophes that are passed into nvalue.
Am I missing something, or should I use a different approach entirely (rather than CDATA) when sending special characters *out* of Flash? Or does this issue really need to be handled at the PHP end? (Note: I'm not doing the PHP personally). My preference would be for a Flash-side solution, so I have control over this issue in the future.
Thanks in advance,
Phil