Go to cflib.org and find the safetext function.
Grant - 28 Sep 2006 16:42 GMT
The Safetext UDF strips out scripts and other undesirable tags. It doesn't do anything to fix the characters I described.
web-spinners - 29 Sep 2006 19:59 GMT
There are two strategies for dealing with unwanted chars.
1. Tell what is not allowed.
2. Tell what is allowed.
The problem with strategy 1 is that you must list ALL the bad chars.
Strategy 2 is better.
The following code uses a Regular Expression .
<cfscript>
function goodChars(str)
{
str = REReplace(str, "[^A-Za-z0-9\=\_\s\-\.##$&@]", "", "ALL");
return str;
}
function hasAllGoodChars(str)
{
if (REFind("[^ A-Za-z0-9\_\-]",str) eq 0){
return true;}else{return false;}
}
</cfscript>
You could run replacements on each variable... proabably not the most
efficient... see below...
<CFSET gecko = #trim(#queryname.fieldname#)#>
<CFSET gecko = #replace(gecko, "character to be replaced", "safe character",
"ALL")#>
<CFSET gecko = #replace(gecko, "é", "e", "ALL")#>
etc...
#gecko#
Provided your code, the CF server, the DB server and the browser are all
told to use the correct (and SAME!) character encoding, you should not have
this problem.
Do a search on these forums for "special characters" for full and
comprehensive discussion on this topic.

Signature
Adam
I finally isolated the problematic characters so I edited the DeMoronize UDF
(available at cflib.org) by adding the following text replacements at the
bottom:
text = Replace(text, chr(8208), "-", "ALL");
text = Replace(text, chr(8209), "-", "ALL");
text = Replace(text, chr(8210), "–", "ALL");
text = Replace(text, chr(8211), "–", "ALL");
text = Replace(text, chr(8212), "—", "ALL");
text = Replace(text, chr(8213), "—", "ALL");
text = Replace(text, chr(8214), "||", "ALL");
text = Replace(text, chr(8215), "_", "ALL");
text = Replace(text, chr(8216), "‘", "ALL");
text = Replace(text, chr(8217), "’", "ALL");
text = Replace(text, chr(8218), ",", "ALL");
text = Replace(text, chr(8219), "'", "ALL");
text = Replace(text, chr(8220), "“", "ALL");
text = Replace(text, chr(8221), "”", "ALL");
text = Replace(text, chr(8222), """", "ALL");
text = Replace(text, chr(8223), """", "ALL");
text = Replace(text, chr(8226), "·", "ALL");
text = Replace(text, chr(8227), ">", "ALL");
text = Replace(text, chr(8228), ".", "ALL");
text = Replace(text, chr(8229), "..", "ALL");
text = Replace(text, chr(8230), "...", "ALL");
text = Replace(text, chr(8231), "·", "ALL");