I am trying to display an email formatted as "FirstName LastName <FirstNameLastName@domain.com>" in HTML, and it is only displaying “FirstName LastName”.
Pseudo-code:
<cfset LOCAL.From = "FirstName LastName <FirstNameLastName@domain.com>" />
<cfoutput>#Local.From#</cfoutput>
I know I can replace the less-than and greater-than signs with lt; and gt;, but I’m looking for a better way than Replace(Replace(LOCAL.Form, "<", ";lt;"), ">", ">").
I’m not very good with Regular Expressions, if that’s the way to go, so show me a good RegEx for this, if you’d like.
Or, if this can be done simply with some ColdFusion function, that’s great too.
You’re looking for HTML encoding, rather than string replacement. Use HtmlEditFormat.
Possibly related: How to encode HTML form in coldfusion?