[thelist] CF -- scrubbing special characters

Joshua Olson joshua at waetech.com
Mon Sep 9 20:02:01 CDT 2002


----- Original Message -----
From: ".jeff" <jeff at members.evolt.org>
Sent: Monday, September 09, 2002 8:53 PM


> rudy's point though is that &#0149; is no longer considered a valid
numeric character entity.  we should be using &bull; or &#8226; instead.
the same for &#0151; which should be replaced with &mdash; or &#8212;.
>
> http://evolt.org/article/character_entity_chart/17/21234/

.jeff,

point taken.  The code I offered was offered as a suggested direction.  Hand
coding the replacement list, rather than automatically generate the list
using the for loop like in the example, will suit whatever needs Rudy has in
most cases.

And I quote:

"Perhaps this could be changed to accommodate your friends code."

Rudy,

simply hand roll the request.bad_chars and request.good_chars list using
known valid entities and you should be good to go.  Something along the
lines of:

<cfset request.bad_chars = "#Chr(151)#,#Chr(666)#">
<cfset request.good_chars = "&mdash;,satan">

Keep in mind that there are a dozen or so ways to approach the problem.
But, the basic premise is to make a list of the bad characters, them a list
of corresponding good chars, and then do a list replace.

-joshua




More information about the thelist mailing list