2 Replies Latest reply on Jul 30, 2010 5:52 PM by celebritymusic

    slashes get added when writing text file - AS3

    celebritymusic Level 1



      I'm using flash and php to write or overwrite a text file (an xml file).  I have text strings that contain the xml data, which then get parsed by the php file.


      It works fine.  However, I notice that the header in the XML file <?xml version='1.0' encoding='utf-8'?> get's replaced with <?xml version=\'1.0\' encoding=\'utf-8\'?>


      Why would slashes get added?


      Here's the text string code in AS3...


      var Everything:String = "<?xml version='1.0' encoding='utf-8'?>\n\n<XML>\n\n"+g1.data.layoutFontsGroup+"\n\n\n        </XML>


      and my php code...


         //Capture data from Flash variable, and add it to "$everything"
         $everything = $_POST['saveThisXML'];
         //Make one big string in a format Flash understand
         $toSave = $everything;


         //Open a file in write mode
         $fp = fopen("test.xml", "w");
         if(fwrite($fp, $toSave)) echo "writing=Ok";
         else echo "writing=Error";


      Thanks for your help on this one.