si-blog

Encode entities and quotes

Posted Feb 03, 2004 in ColdFusion.

Can anyone point me in the direction of ColdFusion functions that mimic PHP's htmlentities($string, ENT_QUOTES) and nl2br($string)?

Update: Just to let you all know, I found that HTMLEditFormat handled the encoding of entities. Converting line breaks into <br> required using the Replace function on the ASCII code for newline characters, which is similar to what Anne suggested in this post's comments.

Comments

  1. Gravatar

    http://www.google.com/search?q=coldfusion+string+replace
    (third hit)
    ;-)

    Posted by Anne on Feb 04, 2004.

  2. Gravatar

    Thanks, Anne. I was hoping that ColdFusion might have some built-in functions that would do the job, though. There is a function called HTMLEditFormat that might work, but I haven't had the opportunity to look at it yet.

    Posted by Simon Jessey on Feb 04, 2004.