Special characters in String variable sent from php.

Hello. Assuming that I send some String variable from php into flash:
AS3:
var MyImportedString:String;
var variables_page_text:URLVariables = new URLVariables();
var varSend_page_text:URLRequest = new URLRequest("MyPHP.php");
varSend_page_text.method = URLRequestMethod.POST;
varSend_page_text.data = variables_page_text;
var varLoader_page_text:URLLoader = new URLLoader;
varLoader_page_text.dataFormat = URLLoaderDataFormat.VARIABLES;
varLoader_page_text.addEventListener(Event.COMPLETE, var_comp_page_text);
varLoader_page_text.load(varSend_page_text);
function var_comp_page_text(event:Event):void {
    MyImportedString =  event.target.data.MyVariable;
php:
<?php
header('Content-Type: text/html; charset=utf-8');
$MyString = "some tekst &";
print "MyVariable=" . $MyString;
?>
   I've noticed that the special character '&' residing inside String, throws an error:  #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.
  My first thought was, it has something to do with html entities, but other entities (like <> or ") don't throw any error. Besides, the use of php functions like htmlentities(); or html_entity_decode(); doesn't make any difference in this case:
print "MyVariable=" . htmlentities($MyString);
or
print "MyVariable=" . html_entity_decode($MyString);
  I've also noticed that characters like '%', '^', '+' don't show up at all;
  What does it mean? Any ideas?
  Reagards.

Thank You 'moccamaximum'.
Ok. So here is the solution (php function posted by 'moccamaximum' does the trick):
AS3:
var MyImportedString:String;
var variables_page_text:URLVariables = new URLVariables();
var varSend_page_text:URLRequest = new URLRequest("MyPHP.php");
varSend_page_text.method = URLRequestMethod.POST;
varSend_page_text.data = variables_page_text;
var varLoader_page_text:URLLoader = new URLLoader;
varLoader_page_text.dataFormat = URLLoaderDataFormat.VARIABLES;
varLoader_page_text.addEventListener(Event.COMPLETE, var_comp_page_text);
varLoader_page_text.load(varSend_page_text);
function var_comp_page_text(event:Event):void {
    MyImportedString =  event.target.data.MyVariable;
     trace(MyImportedString);        // Output:  some text &%^+
php:
<?php
header('Content-Type: text/html; charset=utf-8');
$MyString = "some text &%^+";
print "MyVariable=" . flash_encode($MyString);
function flash_encode($string){
     $string = rawurlencode(utf8_encode($string));
     $string = str_replace("%C2%96", "-", $string);
     $string = str_replace("%C2%91", "%27", $string);
     $string = str_replace("%C2%92", "%27", $string);
     $string = str_replace("%C2%82", "%27", $string);
     $string = str_replace("%C2%93", "%22", $string);
     $string = str_replace("%C2%94", "%22", $string);
     $string = str_replace("%C2%84", "%22", $string);
     $string = str_replace("%C2%8B", "%C2%AB", $string);
     $string = str_replace("%C2%9B", "%C2%BB", $string);
     return $string;
?>

Similar Messages

  • Replace special characters in String

    Dear Guru ,
    Does SAP provide the standard function that can replace the special characters in String ?
    For example :
    I have one template string : " & & & & & output(s) have not been processed yet ! " and five parameters : "P1" , "P2" , "P3" , "P4" , "P5" .
    And i would like to apply all parameters into the string to replace the "&" character . Is it possibile ?
    My idea is sourcing from the Message String that in tcode : SE91 .
    Thanks .
    Best Regards,
    Carlos Zhang

    Hi Carlos,
    I think instead of a standard FM you can write a one line command to do this job.
    E.g. 
    constant: str1 type string value 'output(s) have not been processed yet ! '.
    data: var1 type c,
             var2 type c,
             var3 type c,
             var4 type c,
             str    type string.
    concatenate var1 var2 var3 var4 str1 into str separated by space.
    So str will have the final value.
    Thanks,
    Mainak

  • Receiving variables back from php

    basicaly i have narrowed it down to this code
    stop();
    ////// Assign a variable name for our URLVariables object
    var variables:URLVariables = new URLVariables();
    var varSend:URLRequest=new URLRequest("create_member.php");
    varSend.method=URLRequestMethod.POST;
    varSend.data=variables;
    //////// Build the varLoader variable
    var varLoader:URLLoader=new URLLoader  ;
    varLoader.dataFormat=URLLoaderDataFormat.VARIABLES;
    trace(varSend.data.status);
    trace(varLoader.data.status);
    As silly as it sounds, i need the trace to see the error.
    I am using cs4 for this and have not found anything so far to explain why it is not working.
    You can test it out without needing anything on stage.
    This is the error i get and do not know why.
    undefined               is the varSend trace
    TypeError: Error #1010: A term is undefined and has no properties.
    at Untitled_fla::MainTimeline/frame1()              is the varLoader trace
    I need this fixed, but cant find why it is doing it. Any ideas would be greatly accepted.

    There is a full script as well, but I still only get the errors stated. Basicaly I am unable to get any variables back from PHP. They show up an a standard browser window, but that is no good to me. My site is 100% flash and i need to receive data so that i can log people in, retreive their names and info, send custome messages to people on the site or even if only visitors. Without flash seeing the data correctly, I cant do squat.
    if (event.target.data.returnBody=="") {
    output_txt.text="No data coming through";
    } else if(event.target.data.returnBody!=="") {
    output_txt.condenseWhite = true;
             output_txt.htmlText = ""+ event.target.data.returnBody;
      gotoAndStop("_end");
    trace(varLoader.data.status)
    If i only use    --     event.target.data     I do get the info in, but with all the mish-mash that comes with it
    e.g.
    %0A%20%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%3Ch2%3EOne%20Last%20Step%20%2D%20Activate%20through%2 0Email%3C%2Fh2%3E%3Ch4%3EOK%20peter%2C%20one%20last%20step%20to%20verify%20your%20email%20 identity%3A%3C%2Fh4%3E%3Cbr%20%2F%3E%0D%0A%20%20%20In%20a%20moment%20you%20will%20be%20sen t%20an%20Activation%20link%20to%20your%20email%20address%2E%3Cbr%20%2F%3E%3Cbr%20%2F%3E%0D %0A%20%20%20%3Cbr%20%2F%3E%0D%0A%20%20%20%3Cstrong%3E%3Cfont%20color=%22%23990000%22%

  • Restrict Special Characters in String Fields

    Hello,
    My Jdev version is 11.1.1.6 using ADF BC and ADF Faces as technology stack.
    I have a requirement to restrict special characters, html tags as input in String/Varchar2 fields.
    I have couple of thoughts that can be used in application but not sure which is the best approach:
    1. Implement <af:validateRegExp pattern="regular Exp"> inside <af:inputText> component
    2. Implement Entity based validator using Regular Expression
    Apart from picking the best out of above two, I would like to know if there is a better way to implement this validation.
    My application has custom framework extn classes and all Entities/View Objects extend those. Is there a possibility to implement this type of validation at some central place.
    I would highly appreciate expert inputs here.
    Thanks,
    Jai

    Hi,
    the answer to your question is *"use both"*. The entity level would be enough but then would make people subniitting a request afte which they see an error The RegEx validator in ADF Faces handles problems on the client side and thus before a submit is sent to the server (where it then would be also checked using server side validation in ADF Faces). Why not using RegEx validation in ADF faces alone? Because there are potentially many views accessing your entity through view objects and if only one developer forgets the RegEx validator you would be screwed.
    Frank

  • How to Avoid Special Characters in string

    Hai.
    I want only Alphabets & Digits to be entered in to my string.No any other special characters except spaces.How can I do this? 
    Solved!
    Go to Solution.

    MikeS81 wrote:
    see the attached example.
    I would allow a few more, e.g. 0 and 8 to allow editing of the entered string (backspace, cursor buttons, delete key, etc.).
    Message Edited by altenbach on 11-21-2008 12:49 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    check_char_LV80MOD.vi ‏14 KB
    FilterStringInput.gif ‏6 KB

  • How to replace special characters in string.

    Hello,
    I want to replace special characters such as , or ; with any other character or " ".I find out there is no such function is java for this.There is only replace() but it accepts only chars.If anybody know how to do this?.
    Thanks,

    Hello,
    I want to replace special characters such as , or ;
    with any other character or " ".I find out there is no
    such function is java for this.There is only replace()
    but it accepts only chars.If anybody know how to do
    this?.
    Thanks,Can't you just do the following?
    public class Test
         public static void main(String[] args)
         String testString = "Hi, there?";
         System.out.println(testString.replace(',',' '));
    }

  • Convert HTML special characters to String

    Hi,
    I'm looking for an easy way to convert HTML special characters (like "&#246") to String.
    Any Ideas how implement this? Thanks

    Hi,
    I'm looking for an easy way to convert HTML special
    characters (like "�") to String.
    Any Ideas how implement this? Thankswell im assuming that you mean that when you are working with java you will be getting a ? instead of the character you want. assuming that you are reading and writing to this html file. if not well maybe this can stil help : BufferedReader inFile = new BufferedReader(new InputStreamReader(new FileInputStream(fileName),"ISO8859-1"));
    PrintWriter outFile = new PrintWriter(new OutputStreamWriter(new FileOutputStream(fileName2), "ISO8859-1")); basically you need to make sure that ou define ISO8859-1 as the encoding.

  • Remove special characters in string

    Hi all,
    I'm Portuguese, and in our language we use special characters in words like "João or "Sónia".
    I need to take off these special characters, which means I want to have the same words like "Joao" and "Sonia", without the characters "~" or "´".
    Do you have any idea how can I do this?
    Thanks in advance.
    Best regards,
    Sónia Gonçalves

    Hi,
    But I want to make this generic, I don't want to replace character by character.
    If I give a string in the program, I want to search all ocurrences of these special characters and replace them.
    How can I do this?
    Thanks.
    Best regards,
    Sónia Gonçalves

  • Creating a array from variables passed from php

    I have passed variables from PHP to flash successfully but
    now need to firstly make them into an array. A next button and
    previous button has to trigger the step through the array.
    Any ideas?

    I have a PHP script and I get flash to load the variables
    from it. The code is as follows. Taken out the connection to DB for
    security.
    <?php
    $hostname_conn = "";
    $database_conn = "";
    $username_conn = "";
    $password_conn = "";
    // establish a SQL connection to the host - host, user, pass
    $conn = mysql_pconnect($hostname_conn, $username_conn,
    $password_conn) or trigger_error("The site database appears unable
    to provide a connection. Please contact support.
    ".mysql_error(),E_USER_ERROR); // or die("The site database appears
    unable to provide a SQL connection. Please contact support.");
    // connect to the right DB (there may be multiple db's on the
    server) dbName
    mysql_select_db($database_conn, $conn) or die("The site
    database appears to be unavailable. Please contact support.");
    $qCheck = "SELECT * FROM pics";
    $rsCheck = mysql_query($qCheck) or die("Check Failed :
    ".mysql_error());
    $cCheck = mysql_num_rows($rsCheck);?>
    &img=<?php
    while($row= mysql_fetch_assoc($rsCheck))
    print($row["img"]);
    ?>

  • Format Special Characters In Strings

    Is there a simple way of formatting or automatically escaping special characters in a string?
    For example if I have a string that has double quotes in it and I want to escape them, so...
    a = "This is a "string" object"becomes...
    a = "This is a \"string\" object"

    public static String escape(String s)
        String sOut;
        sOut = replace(s, "\\", "\\\\");
        sOut = replace(sOut, "'", "\\'");
        sOut = replace(sOut, "\"", "\\\"");
       sOut = replace(sOut, "\"", """);
        sOut = replace(sOut, "'", "&#039;");
        sOut = replace(sOut, ">", ">");
        sOut = replace(sOut, "<", "<");
        sOut = replace(sOut, "�", "&#xA3;");
        sOut = replace(sOut, "�", "&#xA4;");
        return (sOut);
      }Hope this helps

  • Sending variable value from php to flash to load an xml file

    I would like to load an XML file from the location locally or on the server being unaware of the name of the file. I am using PHP for sending the filename to Flash.
    The below is the PHP code:
    <?php
    filesInDir('C:\Documents and Settings\457305\My Documents\shrikant\Flash Tutorials\webassist');
    function filesInDir($tdir)
            $dirs = scandir($tdir);
            foreach($dirs as $file)
                    if (($file == '.')||($file == '..'))
                    elseif (is_dir($tdir.'/'.$file))
                            filesInDir($tdir.'/'.$file);
                    else
                            echo "fileName=$file";
    ?>
    And below is the loading Actionscript code:
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.events.Event;
    import flash.net.URLVariables;
    stop();
    // Define the PHP file to be loaded
    var phpFile:String = "http://localhost/webassist/test.php";
    var cons_xml:XML;
    var xmlLoader:URLLoader = new URLLoader();
    // Specify dataFormat property of the URLLoader to be "VARIABLES"
    // This ensures variables loaded into Flash with same variable names
    xmlLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
    xmlLoader.load(new URLRequest(phpFile));
    xmlLoader.addEventListener(Event.COMPLETE, processXML);
    function processXML(evt:Event):void
              trace(evt.target.data.fileName);
              //cons_xml = new XML(evt.target.data.fileName);
              //gotoAndPlay(2);
    When I trace the evt.target.data it displays "fileName=mainOpenEndedXML%2Exml" and when I trace evt.target.data.fileName the fileName is properly displayed as "mainOpenEndedXML.xml".
    But in the next two lines where the loading occurs it does not load the file i.e the swf file from xml doesn't play.
    I have been searching the Internet for answers but not able to find any solutions.
    The loading works properly if i directly insert the xml file in the code and the swf's in the XML file play propertly. The below is the code for the same:
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.events.Event;
    import flash.net.URLVariables;
    stop();
    var cons_xml:XML;
    var xmlLoader:URLLoader = new URLLoader();
    xmlLoader.load(new URLRequest("mainOpenEndedXML.xml"));
    xmlLoader.addEventListener(Event.COMPLETE, processXML);
    function processXML(evt:Event):void
              cons_xml = new XML(evt.target.data);
              gotoAndPlay(2);
    Any help on this would be greatly appreciated

    Yes. you already said that, but I guess you don't understand what I said.  You are loading the PHP fle to get the filename, but nowhere are you taking that filename and loading the file that was named. 
    You need to do two loading operations.  The first one to get the filename, and the second to load the file with that name.  Maybe if you name the PHP file loader phpLoader instead of xmlLoader it will start to make more sense to you.  Something like the following...
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.events.Event;
    import flash.net.URLVariables;
    stop();
    // Define the PHP file to be loaded
    var phpFile:String = "http://localhost/webassist/test.php";
    var phpLoader:URLLoader = new URLLoader();
    // Specify dataFormat property of the URLLoader to be "VARIABLES"
    // This ensures variables loaded into Flash with same variable names
    phpLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
    phpLoader.load(new URLRequest(phpFile));
    phpLoader.addEventListener(Event.COMPLETE, processPHP);
    function processPHP(evt:Event):void
             var xmlLoader:URLLoader = new URLLoader();
             xmlLoader.load(new URLRequest(String(evt.target.data.fileName)));
             xmlLoader.addEventListener(Event.COMPLETE, processXML);
    var cons_xml:XML;
    function processXML(evt:Event):void
              cons_xml = new XML(evt.target.data);
              gotoAndPlay(2);

  • Find special characters in string (using mask)

    Hi all,
    I have the following requirement, perhaps someone has got a hint for me:
    I have got a string of 255 characters.
    I want to realize that this string only contains characters of a "normal" format, like
    a-z, A-Z and numbers.
    Any characters like , - # for example are not allowed and I would like to know, how to check my string.
    How can I achive that? With FIND or SEARCH?
    I am not really familiar with these ABAP KEY WORDS. Can I use masks for example like
    DATA:  no_good type c value '[#,+,*...)
    FIND no_good in STRING
    or something like that?
    Thanks and best regards
    Andreas

    Hi Try the below code:
    data: l_data(10) type c,      
          l_special(10) type c.
    l_data = 'AAA%%AA'.          " You can give your value here
    L_special = '!@#$%^&*()'.     " This need to be maintained wth the char which you don't want
    IF l_data ca l_special.
    WRITE: 'Special'.
    else.
    WRITE: 'Only ALPHA.'.
    ENDIF.
    P.S. - @ Rob, sorry I haven't check you have already given this as CO. Just a doubt, I think we have to use CA here, because we need to check this for each byte level.
    Edited by: Kuntal Nandi on Mar 30, 2009 2:55 PM

  • AS3 send/import variables to/from php file

    Hi
    im new I would like to send some variables from ac3 to a
    php-file. the
    php-file have to copperate with this variable (send
    querystring to
    mysql-server).
    ac3 have to read then new variables and traced it on the
    screen.
    i found some examples on the net but i have not undersood
    any.
    can you please explane that to me????
    Sebastian

    Hi
    im new I would like to send some variables from ac3 to a
    php-file. the
    php-file have to copperate with this variable (send
    querystring to
    mysql-server).
    ac3 have to read then new variables and traced it on the
    screen.
    i found some examples on the net but i have not undersood
    any.
    can you please explane that to me????
    Sebastian

  • Assign Prompt from string variable recieved from Enterprise Info

    We have a customer that would like all their incoming scripts to share a common afterhours greeting.  They want to have a specific menu of options one of which is the hours of operations.  Each of these location's hours of operations could and most likely are different.  I am able to send the value of which "location" was orginally called into the common afterhours script from there I would like to set the afterhours prompt to the appropriate recording.  I know I could do this with a series of IF THEN's but they have over 25 locations that might ring into this common afterhours greeting.  What I would like to be to do is the following:
    I am using the CRS editor for this:
    Set the Location variable to the result of the Enterprise call info that is recieved.
    Menu,
    Press 1 for Something
    Press 2 for Something Else
    Press 3 for hours of operation
      Is there a way here to simply play a prompt that was "set" by the value of the Location variable?
    Please let me know if you need more information...
    Thanks,
    Joe

    Hi
    If you have 25 other scripts each setting this enterprise data to a particular value, why not just play the location dependant part in those 25 scripts, before sending to the common script for the 'generic' treatment that follows?
    If you want to play the prompt that matches the ent data, just set a String to the value of the ent data and then use a 'Play Prompt' and put in
    varname + ".wav"
    In the prompt field.
    Aaron
    Please rate helpful posts..

  • Strange variables retrieved from php script

    Hi,
    I am experiencing a really strange thing when making my flash
    movie communicate with a php script.
    No matter what the animation is doing, just consider the
    following :
    see code below
    ticket is the object which receives the response from server
    which returns
    echo utf8_encode("reponse=ok")
    Each time when I run it , (ticket.retour.toString() != "ok")
    returns true, and the redirection url shows the following :
    http://xx.yy.zz.uu/jeu_avertissement.php?type=PROBLEME_CONNECTION&retour=ok&d=0.02&u=1&k=7 39f4db19af87cc0f2b72a6f63698500
    showing value of my retour var which is equal to .... ok
    I really don't understand! Could anybody explain me what
    happened. It looks like I saw a UFO.
    Thanks in advance,
    Pascal

    Damn it i found :D
    i had to write :
    for (i=0; i<_root.tab_result.liste_lenght; i++) {
    myCB.addItem(_root.tab_result['ville'+i],_root.tab_result['ville'+i]);
    I just hope it could help someone else ahahha
    Bye ;)
    Séb.

Maybe you are looking for

  • Service desk RFC destination in the Satellite system

    HI All,       can any body tell me the RFC destination that is to be maintianed in the satellite system so that the message reaches the solution manager service desk. I am creating messages they are being send to the service desk successfully but are

  • Can you have both Wireless and USB printing configured simultaneously on HP Laser mono 1102w

    Hi Guys / HP, Just wondering if you can have the HP Printer mono laser p1102w setup for both USB2 cable hard-wired to notebook and for wireless connections concurrently. Trying to install printer with both setups via install CD on my HP notebook Pavi

  • Output verbose to file and console?

    Hello all, I'm running my PowerShell script from a batch file, and I'm trying to output the verbose statements to a log file as well as to the console. In the batch file I have: powershell.exe -command ".\Script.ps1 -verbose 4> ScriptLOG.txt" What I

  • Problem with Decision step execution

    Hi Friends, I have a problem with executing a decision step. When I execute the decision using SAP_WAPI_DECISION_COMPLETE the workitem goes to completed state and doesn't do anything after that. But when I execute the same step from SBWP the subseque

  • Problem of configuration the requirement output control ?

    Hi , i am now in a very urgent situation that is the system does not create the message type after executing the transaction VL31N. In detail :    I have used the transaction NACE to configure the "Requirements output control" and i have created 3 me