Copy link to clipboard
Copied
Hi Folks,
I'm using BBC's glow to make an ajax post to a coldfusion page.
It works fine apart from displaying the results in a div with all the html escaped.
Does anyone know how I can display the results as html?
Is there a coldfusion tag/ function that turns special chars into html?
Many thanks
<div id="alert">
<table width="100%" border="0" cellspacing="5" cellpadding="5">
<tr>
<td>Name</td>
<td>Lead</td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td>ABDUL KADIR</td>
<td></td>
</tr>
<tr>
<td>Abigail Clinton</td>
<td></td>
</tr>
<tr>
<td>Adrienne Parker</td>
<td></td>
</tr>
<tr>
<td>Aileen Makohon</td>
<td></td>
</tr>
<tr>
<td>Aimee Garbett</td>
<td></td>
</tr>
<tr>
<td>Alison Boughey</td>
<td></td>
</tr>
<tr>
<td>Alison Durman</td>
<td></td>
</tr>
<tr>
<td>Alison Hodgson</td>
<td></td>
</tr>
<tr>
<td>Amy Harrison</td>
<td>1</td>
</tr>
<tr>
<td>Matthew Harris</td>
<td>1</td>
</tr>
<tr>
<td>Clare Neill</td>
<td>1</td>
</tr>
<tr>
<td>Lynne Thompson</td>
<td>1</td>
</tr>
<tr>
<td>Clare Neill</td>
<td>1</td>
</tr>
<tr>
<td>Amanda Harris</td>
<td>0</td>
</tr>
<tr>
<td>Amanda Harris</td>
<td>0</td>
</tr>
<tr>
<td>Amanda Harris</td>
<td>0</td>
</tr>
<tr>
<td>Amanda Harris</td>
<td>1</td>
</tr>
<tr>
<td>Amanda Harris</td>
<td>1</td>
</tr>
<tr>
<td>Matthew Harris</td>
<td>1</td>
</tr>
<tr>
<td>Matthew Harris</td>
<td>1</td>
</tr>
<tr>
<td>Matthew Harris</td>
<td>1</td>
</tr>
<tr>
<td>Matthew Harris</td>
<td>1</td>
</tr>
<tr>
<td>Matthew Harris</td>
<td>1</td>
</tr>
<tr>
<td>Matthew Harris</td>
<td>1</td>
</tr>
<tr>
<td>Matthew Harris</td>
<td>1</td>
</tr>
<tr>
<td>Matthew Harris</td>
<td>1</td>
</tr>
<tr>
<td>Matthew Harris</td>
<td>1</td>
</tr>
<tr>
<td>Amanda Harris</td>
<td>0</td>
</tr>
<tr>
<td>Amy Harrison</td>
<td>0</td>
</tr>
<tr>
<td>Amanda Harris</td>
<td>0</td>
</tr>
<tr>
<td>Amanda Harris</td>
<td>0</td>
</tr>
</table> </div>
Without drilling down to the problem - why the characters show up in escaped format, I'll just answer the one question:
No, there is not a function in ColdFusion which unescapes escaped HTML strings. Neither has anyone published such function on cflib.org.
But unescaping is easy with ReplaceList() function. Just have the most typical/probably escaped and unescaped strings in the argument lists, and you'll have yourself a function.
Something like this:
<cfscript>
public function HtmlUnescape(htmlstrin
...Copy link to clipboard
Copied
Without drilling down to the problem - why the characters show up in escaped format, I'll just answer the one question:
No, there is not a function in ColdFusion which unescapes escaped HTML strings. Neither has anyone published such function on cflib.org.
But unescaping is easy with ReplaceList() function. Just have the most typical/probably escaped and unescaped strings in the argument lists, and you'll have yourself a function.
Something like this:
<cfscript>
public function HtmlUnescape(htmlstring)
{
return replaceList(arguments.htmlstring,">,<",">,<");
//add any other probable special characters and their encodings also to the list
}
</cfscript>
<cfsavecontent variable="test">
<table width="100%" border="0" cellspacing="5" cellpadding="5">
</cfsavecontent>
<cfoutput>
original: #htmlcodeformat(test)#
<br>
unescaped: #htmlcodeformat(HtmlUnescape(test))#
</cfoutput>
-Fernis
Copy link to clipboard
Copied
Thanks very much for your reply