stumbled across this:
=========================
http://affy.blogspot.com/2003_01_12_affy_archive.html

Pasting From MS Word Results in Weird Characters: The following fixes the
problem for the ColdFusion server (from Cameron Childress).


Add these lines to the application.cfm: 

<cfprocessingdirective pageencoding="iso-8859-1">
<cfset setEncoding("form","iso-8859-1")>
<cfset setEncoding("URL","iso-8859-1")>
<cfcontent type="text/html; charset=iso-8859-1">

======================================

which really just handles display, not input, 


as to the CFLIB.org UDF (http://www.cflib.org/udf.cfm?ID=319): that only
takes care of the single and double quotes. there are lots of other
nasties such as "m and n dash" (long and short hyphen), etc which the
following function does as well:

NOTE: 

all of this is brought about by web browsers having a hell of a time with
extended charactor sets. that's why these are here - knock 'em down so the
browser will understand. It's now up to you to either
 - trust the input from Word text and store that in the db and then clean
on display OR
 - convert the chars on input knowing that, down the track, you may want
to feed that Word text to Flash or somthing else.

these are just some of the more common PITB (pain in the bum) charactors

Replace(text, chr(145), chr(39),"ALL")> <!--- "single open" --->
Replace(text, chr(146), chr(39),"ALL")> <!--- "single closed" --->
Replace(text, chr(147), chr(34),"ALL")> <!--- "dbl open" --->
Replace(text, chr(148), chr(34),"ALL")> <!---  "dbl close" --->
Replace(text, chr(150), chr(45),"ALL")> <!---"short hyphen" --->
Replace(text, chr(151), chr(45),"ALL")> <!---"long hyphen" --->

PS: I'm not old! Grrrrr!!!
cheers
barry.b



<cffunction access="public" name="htmlFormatText" output="true" returntype="string" 
displayname="htmlFormatText" hint="takes text and replaces non-HTML chars">
<cfargument default="" type="string" name="text">
 <cfset text = trim(text)>
 <cfset text = Replace(text, "&","&amp;","ALL")> <!--- "ampersands" --->
 <cfset text = Replace(text, "<","&lt;","ALL")> <!---  "less-than" --->
 <cfset text = Replace(text, ">","&gt;","ALL")> <!--- "greater-than" --->
 <cfset text = Replace(text, chr(13) & chr(10),"<br />","ALL")> <!---newline--->
 <cfset text = Replace(text, chr(9),"&nbsp;&nbsp;&nbsp;&nbsp;","ALL")> <!--- tab --->
 <cfset text = Replace(text, chr(145), chr(39),"ALL")> <!--- "single open" --->
 <cfset text = Replace(text, chr(146), chr(39),"ALL")> <!--- "single closed" --->
 <cfset text = Replace(text, chr(147), chr(34),"ALL")> <!--- "dbl open" --->
 <cfset text = Replace(text, chr(148), chr(34),"ALL")> <!---  "dbl close" --->
 <cfset text = Replace(text, chr(150), chr(45),"ALL")> <!---"short hyphen" --->
 <cfset text = Replace(text, chr(151), chr(45),"ALL")> <!---"long hyphen" --->
 <cfset text = Replace(text, chr(133), "&##133;","ALL")> <!---  "elipsis" --->
<cfreturn text>
</cffunction>

 

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Reply via email to