Hi, I tried the <?php echo "&sentStr=".rawurlencode($string)."&"; ?> thing, but I get the same problem as when I was using urlencode($string). Flash grabs the string and automatically decodes it, so when I put it in the XML constructor, I get an invalid XML string.
About using the XML object directly instead of LoadVars, I don't think it would work. I am sending data to a PHP script using POST, which queries a DB and returns the result as an XML tree. I can't use the XML class' send or sendAndLoad methods because these send an XML file to the PHP script instead of data in the POST array. Is there another way of using the XML class directly that I am missing? The pipe-encoding solution works, but it would be nice to have something a little more general... Thanks On 8/9/06, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote:
Message: 9 Date: Tue, 8 Aug 2006 20:39:31 +0200 From: "Sebastian Wichmann" <[EMAIL PROTECTED]> Subject: Re: [Flashcoders] quotes in XML To: "Flashcoders mailing list" <[email protected]> Message-ID: <007c01c6bb19$fd403d60$31ddfea9 @svox> Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Hi, try this: <?php echo "&sentStr=".rawurlencode($string)."&"; ?> Flash: unescape(string); Regards, Sebastian Wichmann -----Urspr�ngliche Nachricht----- Von: "Elie Zananiri" <[EMAIL PROTECTED]> An: "Flashcoders mailing list" <[email protected]> Gesendet: Dienstag, 8. August 2006 20:28 Betreff: Re: [Flashcoders] quotes in XML > Thanks, that worked! > > I actually XML-encoded the string in PHP using pipes instead of ampersands > and then converted the pipes back to ampersand in Flash once the string > was > received. The conversion from XML-encoding to regular characters is done > automatically. > > ************************************************************** > in PHP: > $string = pipe_encode($string); > echo "&sentStr=".$string."&"; > > function pipe_encode($str) { > $encoded = ""; > > // encode each character one at a time > for ($i=0; $i < strlen($str); $i++) { > $currChar = substr($str, $i, 1); > > switch ($currChar) { > case '<': > $encoded .= "|lt;"; > break; > case '>': > $encoded .= "|gt;"; > break; > case '&': > $encoded .= "|amp;"; > break; > case '\'': > $encoded .= "|apos;"; > break; > case '"': > $encoded .= "|quot;"; > break; > default: > $encoded .= $currChar; > } > } > > return $encoded; > } > > in Flash: > var myXML:XML = new XML(loadedString.split("|").join("&")); > ************************************************************** > > On 8/8/06, Steven Sacks | BLITZ <[EMAIL PROTECTED]> wrote: >> >> Character substitution, perhaps? >> >> Use pipes | perhaps. >> >> Then, in Flash... >> >> myLoadedString.split("|").join("\""); >> >> _______________________________________________ >> [email protected] >> To change your subscription options or search the archive: >> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders >> >> Brought to you by Fig Leaf Software >> Premier Authorized Adobe Consulting and Training >> http://www.figleaf.com >> http://training.figleaf.com >> > > > > -- > Elie Zananiri > http://www.prisonerjohn.com > http://www.digital-spa.com > _______________________________________________ > [email protected] > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com >
--------------------------- Message: 5
Date: Tue, 8 Aug 2006 18:16:58 -0700 From: "David Rorex" <[EMAIL PROTECTED]> Subject: Re: [Flashcoders] quotes in XML To: "Flashcoders mailing list" <[email protected]> Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=ISO-8859-1; format=flowed On 8/8/06, Elie Zananiri <[EMAIL PROTECTED]> wrote: > Hello all, > > I have an XML parsing question that I've been trying to solve for a little > while now and I can't get it to work. I have a PHP script that loads text > from an SQL db, formats it in an XML string and sends this string back to > Flash using the LoadVars.sendAndLoad("script.php") function. This text that > I send can be pretty much anything, including "quotes" and <brackets> and I > cannot get Flash to read the XML properly. Wait...is there any particular reason you are using LoadVars instead of the XML class? I think simply using XML instead would solve your problem, without any funny hacks. -David R
------------------------------ Message: 10 Date: Tue, 8 Aug 2006 13:37:17 -0500 From: "ryanm" <[EMAIL PROTECTED]> Subject: Re: [Flashcoders] quotes in XML To: "Flashcoders mailing list" <[email protected]> Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response > I actually XML-encoded the string in PHP using pipes instead of ampersands > and then converted the pipes back to ampersand in Flash once the string > was > received. The conversion from XML-encoding to regular characters is done > automatically. > Another solution would be to use the XML object in Flash, and either XML encode the data or use the CDATA block in the XML. It would be more robust and flexible, not to mention more compatible with other client and server technologies. ryanm
-- Elie Zananiri http://www.prisonerjohn.com http://www.digital-spa.com
_______________________________________________ [email protected] To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com

