Uploaded image for project: 'Lucee Development'
  1. LDEV-457

HTMLEditFormat handling of carriage returns

    Details

    • Type: Bug
    • Status: Deployed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.5.2.004, 5.0.0.60
    • Labels:
      None

      Description

      Forum reference: Forum Reference:https://groups.google.com/forum/?fromgroups=&hl=en#!topic/railo/yAE4kzqJ5EE

      Hello, I've noticed a behavior difference between ACF and Railo that I didn't even know ACF did until I read their docs. (http://help.adobe.com/en_US/ColdFusion/10.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7847.html)

      I have performed a brief Google and JIRA search as well as consulted the Railo function reference and didn't turn up any tickets or documentation on the matter.

      Here it is: The ACF docs for HTMLEditFormat() contain this note: "Return characters are removed; line feed characters are preserved.". By "return characters", it means carriage returns. I noticed this while testing my line break scanner module on ACF and Railo. (http://www.coldbox.org/forgebox/view/Line-Break-Scanner) The code in that module is obviously sensitive to the line endings that exist, and thusly the behavior differed between engines when using HTMLEditFormat.

      In Railo, carriage returns are left in the string when using HTMLEditFormat, but in ACF (as advertized) they are removed. Below is a quick test I threw together to see the behavior. I'm not sure why ACF replaces CRs, but non-the-less it caused issues so the question becomes whether or not this is just an oversight in Railo or a purposeful deviation.

      Test Code

      <cfscript>
          CR = chr(13);
          LF = chr(10);
          CRLF = CR&LF;
          CRMarker = '<span class="CR">CR</span>';
          LFMarker = '<span class="LF">LF</span>';
                 
          function visualiseLineBreaks(myString) {
              myString = replace(myString,CR,"__CR__","all");
              myString = replace(myString,LF,"__LF__","all");
              myString = replace(myString,"__CR____LF__",CRMarker&LFMarker&CRLF,"all");
              myString = replace(myString,"__CR__",CRMarker&CRLF,"all");
              myString = replace(myString,"__LF__",LFMarker&CRLF,"all");
              return myString;
          }
         
          myString = '<#CR#>#LF#&#CRLF#"';
          myHTMLEditFormattedString = HTMLEditFormat(myString);
         
      </cfscript>
      
      <style>
      .CR {
          color:red;
          font-weight:bold;
      }
      
      .LF {
          color:green;
          font-weight:bold;
      }
      </style>
      
      <cfoutput>
          <strong>Original String:</strong>
          <pre style="color:grey">#visualiseLineBreaks(myString)#</pre>
          <strong>Formatted String:</strong>
          <pre style="color:grey">#visualiseLineBreaks(myHTMLEditFormattedString)#</pre>
      </cfoutput>
      
      

      Output on ACF

      Original String:
      
      <CR
      >LF
      &CRLF
      "
      
      Formatted String:
      
      <>LF
      &LF
      "
      

      Output on Railo

      Original String:
      
      <CR
      >LF
      &CRLF
      "
      
      Formatted String:
      
      <CR
      >LF
      &CRLF
      "
      

        Attachments

          Activity

            People

            • Assignee:
              michaeloffner Michael Offner
              Reporter:
              bdw429s Brad Wood
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: