3 Replies Latest reply on May 20, 2010 5:45 AM by BhaskerChari

    HTTPService or <mx:RichTextEditor isn't working well - htmlText

    Jotajota-br

      Hello
      I'm working with  the component <mx:RichTextEditor/>

      I have a big  problem after the HTTPService send the code and stores it in database.

      Every time I  catch the htmlText from RichTextEditor,  he is putting a strange tag. I need to clean these tags.

      I send this HTML  code (htmlText from RichTextEditor) and store in the database.
      In  another moment I want to retrieve this code and throw in a TextArea.- this is the objetives, but  I had a problem with this.

      Look my code:

       

       

      <mx:RichTextEditor id="ds_noticia" title="Descrição da notícia"

                              width="80%" htmlText="{dgNotRequest.selectedItem.dsNews}" />

       

      <mx:Button id="submit" label="{'ADD'}"  click="finish()" />

       

      //Script:

      private function concluir():void{

            newsService.send();

      }

       

      <mx:HTTPService id=" newsService " url=" class/class_news.php"

                  resultFormat="object" result="newsHandler(event)" fault="faultHandler(event)" method="POST" >

                  <mx:request xmlns="">                   

                                                   <ds_noticia><![CDATA[{ds_noticia.htmlText}]]></ds_noticia>

                  </mx:request>

      </mx:HTTPService>

       

      Whit firebug I can see the post:

       

      ds_noticia<TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0"><B>Introdução as tecnicas inter latifundiarias</B></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">Aplicabilidade e manutenbilidade da gestão de requisito de isotopo por molécula astridente:<B></B></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0"><B></B></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0"><B>Números</B></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">A tecnologia foi adotada pela Cast há mais de dois anos e chegou a ter mais de 200 servidores virtuais. </FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0"></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">O projeto de virtualização demorou seis meses para ficar pronto e foram gastos quase R$ 600.000,00 na compra de equipamentos, software, instalação e treinamento.</FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0"></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">Sem a virtualização, a Cast gastaria com renovações e novas aquisições, isso sem considerar o aluguel de espaço físico e custos com energia.</FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0"></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0"><B>Resultados</B></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">Desde a implementação da virtualização foi possível reduzir o tempo de atendimento de serviços de dias para horas.</FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0"></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">Essas ações são importantes para a empresa, a sociedade e, principalmente, para o planeta. </FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0"></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0"><B>Fonte: </B></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><LI><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">Gilson Fabio Robles Bernichi - Administrador de Banco Dados</FONT></LI></TEXTFORMAT><TEXTFORMAT LEADING="2"><LI><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">James Lima da Silva - Coordenador de Suporte ao Desenvolvimento</FONT></LI></TEXTFORMAT><TEXTFORMAT LEADING="2"><LI><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">Leonardo Amorim de Araujo – Coordenador de Infraestrutura e Segurança</FONT></LI></TEXTFORMAT>

       

      If I could save this code, it would be  perfect!

       

      BUT the answer, after HTTPService send the content and it is saved into database

      now the HTTPService show other code, this is not the same first code sanded!

       

      ds_news           = '<TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\"><B>Introdução as tecnicas inter latifundiarias</B></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\">Aplicabilidade e manutenbilidade da gestão de requisito de isotopo por molécula astridente:<B></B></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\"><B></B></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\"><B>Números</B></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\">A tecnologia foi adotada pela Cast há mais de dois anos e chegou a ter mais de 200 servidores virtuais. </FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\"></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\">O projeto de virtualização demorou seis meses para ficar pronto e foram gastos quase R$ 600.000,00 na compra de equipamentos, software, instalação e treinamento.</FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\"></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\">Sem a virtualização, a Cast gastaria com renovações e novas aquisições, isso sem considerar o aluguel de espaço físico e custos com energia.</FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\"></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\"><B>Resultados</B></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\">Desde a implementação da virtualização foi possível reduzir o tempo de atendimento de serviços de dias para horas.</FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\"></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\">Essas ações são importantes para a empresa, a sociedade e, principalmente, para o planeta. </FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\"></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\"><B>Fonte: </B></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><LI><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\">Gilson Fabio Robles Bernichi - Administrador de Banco Dados</FONT></LI></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><LI><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\">James Lima da Silva - Coordenador de Suporte ao Desenvolvimento</FONT></LI></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><LI><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\">Leonardo Amorim de Araujo ? Coordenador de Infraestrutura e Segurança</FONT></LI></TEXTFORMAT>'

       

      who can help me ?

      Who can imagine what is happened?

      Who can understand why the flex put  a tag (/) always before the sing (“)?

       

       

      Thank you for help me

        • 1. Re: HTTPService or <mx:RichTextEditor isn't working well - htmlText
          UbuntuPenguin Level 4

          It seems like your quotes are being escaped by the backend when being pushed to the database.  Are you using php/mysql , if so , look into magicquotes , whether they are on or off.

          • 2. Re: HTTPService or <mx:RichTextEditor isn't working well [Solved]
            Jotajota-br Level 1

            Thanks!!!!

            This problem isn't with Adobe Flex. This problema is because PHP configuration at PHP.ini

             

            When on, all ' (single-quote), " (double quote), \ (backslash) and NULL characters are escaped with a backslash automatically.

            "Quando ligada, qualquer ' (aspas simples), "      (aspas duplas), \ (barra invertida) e NULL      será colocado uma barra-invertida antes (' vira \') automaticamente".

             

            Is a tecnique of incripiting by PHP but this feature has been DEPRECATED as of PHP 5.3.0. As my Case.


            LOOK the steps


            1.       Check php.ini into server:

            a.       Acess: /etc/php5/apache2/php.ini (In my case, i'm working with Linux-Umbuntu)

             

            2.       Verify the part that mentioned about eMagic quotes. It need be stay like fallow example:

             

            ; Magic quotes

            ;

             

            ; Magic quotes for incoming GET/POST/Cookie data.

            magic_quotes_gpc = Off

             

            ; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.

            magic_quotes_runtime = Off

             

            ; Use Sybase-style magic quotes (escape ' with '' instead of \').

            magic_quotes_sybase = Off

             

            ; Automatically add files before or after any PHP document.

            auto_prepend_file =

            auto_append_file =

             

            ; As of 4.0b4, PHP always outputs a character encoding by default in

            ; the Content-type: header.  To disable sending of the charset, simply

            ; set it to be empty.

            ;

            ; PHP's built-in default is text/html

            default_mimetype = "text/html"

            default_charset = "utf-8"

             

            ; Always populate the $HTTP_RAW_POST_DATA variable.

            ;always_populate_raw_post_data = On

             

             

            3.       If necessary and diferent,  disable the magic Quotes in php.ini: Put (OFF) in the place where is (ON)

             

             

            We need change this because:

             

            • Inconvenience, if the property is on, it will put in a strange caracter (\) before ("). It is bat when you need to save html code to keep the format of the text.
            • it change important datas into database
            • This feature has been DEPRECATED as of PHP 5.3.0. Relying on this  feature is highly discouraged.
            • The magic_quotes_gpc directive may only be disabled at the system level, and not at      runtime. In otherwords, use of ini_set() is not      an option.

             

            FONTE: http://www.php.net/manual/en/security.magicquotes.php

             

            thanks again. good luck

            • 3. Re: HTTPService or <mx:RichTextEditor isn't working well [Solved]
              BhaskerChari Level 4

              Hi,

               

              I think you are using PHP as your backend..database.

               

              This problem is not from Flex side...it is in your database end..when you are saving the html data it is saving along with the "\" this is in order to escape the characters. This is because the magicquotes are enabled in php.ini file in your php server.

               

              Try referring to the link below...you will find more details..

               

              http://www.php.net/manual/en/security.magicquotes.what.php

               

               

              In the left menu you have a link "Disabling Magic Quotes" click that link and gothrogh that page you will come to know how to disable MagicQuotes on your PHP server. Once you disable that everything should work fine..

               

              If this post answers your question or helps, please kindly mark it as such.

               

              Thanks,

              Bhasker Chari