Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    HTML special characters: less-than, greater-than

    There is a ListGrid with XML DataSource.

    You can see on the attached screenshot (Screenshot.png) that the value of the field 'message' and 'raw' are encoded.

    Code:
    <raw>&lt;22&gt;Oct  7 15:31:41 zv11 postfix/qmgr[1826]: C02B06F9E7: from=&lt;bvamos@zuriel.hu&gt;, size=362, nrcpt=1 (queue active)</raw>
    The encoded less-than and greater-than characters are handled correctly at beginning of the row but not in the middle of the row.
    Look at the html page: the from address disappears.

    The generated HTML source is very strange (Screenshot-1.png). There is a close tag for the email address.

    Any idea?
    Attached Files

    #2
    I guess it is untouched if the less-than character is followed by a number but decoded if less-than is followeb by an alpha character.

    Comment


      #3
      This occures only if the data comes from a SOAP webservice.

      I'm afraid this is a bug. Any response?
      Last edited by bvamos; 11 Feb 2012, 06:48.

      Comment


        #4
        No response. I've created a testcase. Here is the code and screenshot.

        Code:
        ListGrid g1 = new ListGrid();
        g1.setHeight(100);
        g1.setFields(new ListGridField("message"));
        RecordList data1 = new RecordList();
        ListGridRecord r1 = new ListGridRecord();
        r1.setAttribute("message", "Number: &lt;22&gt; Email: &lt;user@domain.net&gt; Text: &lt;sadsd&gt; Empty: &lt;&gt;");
        data1.add(r1);
        g1.setData(data1);
        g1.setAutoFetchData(true);
        addMember(g1);
                
                
        DataSource ds2 = new DataSource();
        ds2.setDataURL("data/grid.xml");
        ds2.setRecordName("record");
        ds2.setDataFormat(DSDataFormat.XML);
        
        ListGrid g2 = new ListGrid();
        g2.setHeight(100);
        g2.setFields(new ListGridField("message"));
        g2.setDataSource(ds2);
        g2.setAutoFetchData(true);
        addMember(g2);
        XML:
        Code:
        <?xml version="1.0" encoding="UTF-8"?>
        <data>
        <record>
        <message>Number: &lt;22&gt; Email: &lt;user@domain.net&gt; Text: &lt;sadsd&gt; Empty: &lt;&gt;</message>
        </record>
        </data>
        Works fine with this XML:
        Code:
        <?xml version="1.0" encoding="UTF-8"?>
        <data>
        <record>
        <message><![CDATA[Number: &lt;22&gt; Email: &lt;user@domain.net&gt; Text: &lt;sadsd&gt; Empty: &lt;&gt;]]></message>
        </record>
        </data>

        SOMEBODY PLEASE HELP!!!!!!!!!!

        Comment


          #5
          Please read the instructions when you post. You've provided a test case, which is great, but zero information about versions and environments.

          If you haven't already, be sure to use a fully patched build to test (see smartclient.com/builds).

          Comment


            #6
            Hi,

            You are completely right.

            I am using SmartGWT GPL 2.4.
            I've checked now with 2.5 latest nightly build and it seems to be fixed.

            Thank you for your help.

            Balazs

            Comment


              #7
              Unfortunately I was wrong.

              I've tested with 2.5-SNAPSHOT 2012-02-17 and 3.0.

              Here is the screenshot with 2.5p.
              Attached Files

              Comment


                #8
                When you put data values in a grid cell they are interpreted as HTML. The tag <user@domain.net> doesn't exist in HTML and so the browser doesn't render anything.

                If you want a literal '<' to show in the grid, in the XML data file it should be "&lt;lt;" because it's effectively going through two levels of un-quoting. See also the "escapeHTML" property as an alternative.

                Comment


                  #9
                  Hi,

                  ListGridField.setEscapeHTML(true) is the setting what I need. Thank you.

                  Comment

                  Working...
                  X