http://www.cflib.org/udf.cfm?id=725 with line 55 changed (there was a
bug when copied/pasted from cflib). Listing to test follows:
<cfscript>
/**
* Fixes text using Microsoft Latin-1 "Extentions", namely
ASCII characters 128-160.
*
* @param text Text to be modified. (Required)
* @return Returns a string.
* @author Shawn Porter ([EMAIL PROTECTED])
* @version 1, September 16, 2002
*/
function DeMoronize (text) {
var i = 1;
// Map strategically incompatible non-ISO characters in the
// range 0x82 -- 0x9F into plausible substitutes where
// possible.
Text = Replace(Text, Chr(130), ",", "All");
Text = Replace(Text, Chr(131), "<em>f</em>", "All");
Text = Replace(Text, Chr(132), ",,", "All");
Text = Replace(Text, Chr(133), "...", "All");
Text = Replace(Text, Chr(136), "^", "All");
Text = Replace(Text, Chr(139), ")", "All");
Text = Replace(Text, Chr(140), "Oe", "All");
Text = Replace(Text, Chr(145), "`", "All");
Text = Replace(Text, Chr(146), "'", "All");
Text = Replace(Text, Chr(147), """", "All");
Text = Replace(Text, Chr(148), """", "All");
Text = Replace(Text, Chr(149), "*", "All");
Text = Replace(Text, Chr(150), "-", "All");
Text = Replace(Text, Chr(151), "--", "All");
Text = Replace(Text, Chr(152), "~", "All");
Text = Replace(Text, Chr(153), "&tm;", "All");
Text = Replace(Text, Chr(155), ")", "All");
Text = Replace(Text, Chr(156), "oe", "All");
// Now check for any remaining untranslated characters.
for (i = 128; i LTE 160; i = i + 1)
{
Text = Replace(Text, Chr(i), "", "All");
}
// Supply missing semicolon at end of numeric entity
Text = ReReplace(Text, "&##([0-2][[:digit:]]{2})([^;])",
"&##\1;\2", "All");
// Fix obscure numeric rendering of < > &
Text = ReReplace(Text, "&##038;", "&", "All");
Text = ReReplace(Text, "&##060;", "<", "All");
Text = ReReplace(Text, "&##062;", ">", "All");
// Supply missing semicolon at the end of & "
Text = ReReplace(Text, "&(^;)", "&\1", "All");
Text = ReReplace(Text, """(^;)", ""\1", "All");
Return Text;
}
</cfscript>
<!--- Test deMoronize --->
<cfset charList =
"130,131,132,133,136,139,140,145,146,147,148,149,150,151,152,153,155,156
">
<cfset foo = "">
<cfloop list="#charList#" index="i">
<cfset foo = foo & chr(i)>
</cfloop>
<cfoutput>#deMoronize(foo)#</cfoutput>
-----Original Message-----
From: Anne Girardeau [mailto:[EMAIL PROTECTED]
Sent: Monday, June 14, 2004 9:42 AM
To: CF-Talk
Subject: MS Smart Quotes and CFMX 6.1
In the past, I have used DeMoronize to clean up any odd characters that
show up in my database as the result of copying and pasting MS Word
content. However, after recently updating to CFMX 6.1, I have found
that DeMoronize no longer works. Currently, I get a "variable
DeMoronize is undefined" error whenever I try using it in the manner I
have used it in the past. I tried copying the DeMoronize code directly
to the template to overcome this error and although it didn't throw an
error, it also didn't process anything. What, if any, alternatives are
there to using DeMoronize? If there aren't any alternatives, are there
any fixes that will allow DeMoronize to work on CFMX 6.1? Any help with
this would be greatly appreciated.
--Anne
_____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

