Thank you for responding.  I notice that this involves java calls - is there
no native CF function that does this?

Thank you,
Matthew Small

-----Original Message-----
From: Martin Parry [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 10, 2005 8:36 AM
To: CF-Talk
Subject: RE: Capturing Mac's SmartQuotes

How about this - found it the other day while trying to solve a similair
thing where verity wasn't indexing TM signs so I needed to convert them
to normal HTML codes.

<cfset myHTML =  EscapeExtendedChars(evaluate("TableRecords.#tField#"))>


<cffunction name="EscapeExtendedChars" returntype="string">
        <cfargument name="str" type="string" required="true">
        <cfset var buf = CreateObject("java", "java.lang.StringBuffer")>
        <cfset var len = Len(arguments.str)>
        <cfset var char = "">
        <cfset var charcode = 0>
        <cfset buf.ensureCapacity(JavaCast("int", len+20))>
        <cfif NOT len>
                <cfreturn arguments.str>
        </cfif>
        <cfloop from="1" to="#len#" index="i">
                <cfset char = arguments.str.charAt(JavaCast("int",
i-1))>
                <cfset charcode = JavaCast("int", char)>
                <cfif (charcode GT 31 AND charcode LT 127) OR charcode
EQ 10
                        OR charcode EQ 13 OR charcode EQ 9>
                                <cfset buf.append(JavaCast("string",
char))>
                <cfelse>
                        <cfset buf.append(JavaCast("string", "&##"))>
                        <cfset buf.append(JavaCast("string", charcode))>
                        <cfset buf.append(JavaCast("string", ";"))>
                </cfif>
        </cfloop>
        <cfreturn buf.toString()>
</cffunction>

Martin Parry
Macromedia Certified Developer
http://www.BeetrootStreet.co.uk


-----Original Message-----
From: Matthew Small [mailto:[EMAIL PROTECTED] 
Sent: 10 February 2005 13:24
To: CF-Talk
Subject: Capturing Mac's SmartQuotes

Hi,

            One of my users pastes text into a form from his Mac word
processor.  Quite frequently, the document contains "smart quotes" -
curly
quotes that go on each end of a string.  Apparently, some PCs have
issues
displaying these characters, so I need to know how to convert them to
straight normal quotes.

            I am under the impression that these are Unicode characters
as
opposed to ASCII characters.  As such, I am unsure how to do a replace
in CF
- MX 6.1. I've looked in the livedocs but I don't see a function that
works
like chr() for Unicode.  What am I missing here?

 

Thank you,

Matthew Small







~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:194041
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to