Uploaded image for project: 'CMS'
  1. CMS
  2. CMS-9283

Problem with smiley in comments

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • 4.2.5, 4.3.0
    • None
    • None
    • None
    • 4.3 M3

      How to reproduce

      • Write a comment in a form
      • Copy a smiley or write it from a mobile phone
      • Validate the comment

      Actual behavior

      The smiley is going to block the display of comments in the back office.

          [CMS-9283] Problem with smiley in comments

          We also cannot put an emoji in a rich text.

          The bug is actually in the Xalan serializer : https://issues.apache.org/jira/browse/XALANJ-2617

          We can't do anything right now until Xalan provides a fix

          Cédric Damioli added a comment - We also cannot put an emoji in a rich text. The bug is actually in the Xalan serializer : https://issues.apache.org/jira/browse/XALANJ-2617 We can't do anything right now until Xalan provides a fix

          in 4.2, everything is fine.
          the screen is not using XML anymore but JSON to transmit data from the backoffice

          Raphaël Franchet added a comment - in 4.2, everything is fine. the screen is not using XML anymore but JSON to transmit data from the backoffice

          Raphaël Franchet added a comment - - edited

          The issue is that smileys are coded in utf-16

          Here is a script to list comments with issue

          var totalContent = 0;
          var errors = 0;
          
          jcrXPathQuery("//element(*, ametys:content)").forEach(function(content) {
              totalContent++;
          
              var comments = content.getComments ? content.getComments(true, true) : null;
              if (comments && comments.size() > 0)
              {
                  for (var i = 0; i < comments.size(); i++)
                  {
                      var comment = comments.get(i);
          
                      var s = comment.getContent();
                      for (var o=0; o < s.length(); o++)
                      {
                          var bb = new java.lang.String(s.charAt(o)).getBytes("UTF-16");
                          if (bb.length == 4 && bb[2] == -1)
                          {
                              print(content.getId() + " - " + content.getTitle());
                              print(" " + comment.getId() + " - " + comment.getCreationDate() + " - " + s)
                              errors++;
                              break;
                          }
                      }
                  }
              }
          });
          
          print(errors + " erreur(s) sur " + totalContent + " contenus");

           

          Raphaël Franchet added a comment - - edited The issue is that smileys are coded in utf-16 Here is a script to list comments with issue var totalContent = 0; var errors = 0; jcrXPathQuery( " //element(*, ametys:content)" ).forEach(function(content) { totalContent++; var comments = content.getComments ? content.getComments( true , true ) : null ;   if (comments && comments.size() > 0) { for ( var i = 0; i < comments.size(); i++) { var comment = comments.get(i); var s = comment.getContent(); for ( var o=0; o < s.length(); o++) { var bb = new java.lang. String (s.charAt(o)).getBytes( "UTF-16" ); if (bb.length == 4 && bb[2] == -1) { print(content.getId() + " - " + content.getTitle()); print( " " + comment.getId() + " - " + comment.getCreationDate() + " - " + s) errors++; break ; } } } } }); print(errors + " erreur(s) sur " + totalContent + " contenus" );  

            cedric Cédric Damioli
            afrancois Anastasia François
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: