House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

Handling MS Word "Smart" Quotes

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Ian Skinner
04/29/2003 11:02 AM

I've got an simple content management application where users cut and paste text from MS word into form fields that are then inserted into a MS SQL 2000 database.  Subsequently this text is pulled out of the database and displayed in HTML pages to other users.  Pretty standard stuff. The trouble I'm having is with MS Word's smart quotes, those fancy single and double quote marks that are curved.  When these are cut and pasted into the form and then pulled out to display, the HTML does not recognize the characters and display's small boxes.  Is there a simple way to scrub my database of these smart-aleck marks and replace them with their straight-laced cousins and/or format my HTML so that it understands the smarty pants curvy ones?   I'm hoping for a simple automated solution that I can apply globally so that the poor content admin doesn't have to go back to the 100's of documents to find and change each curvy single and double quote mark by hand. -------------- Ian Skinner Web Programmer BloodSource Sacramento, CA

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Massimo Foti
04/29/2003 11:08 AM

> The trouble I'm having is with MS Word's smart quotes, those fancy single > and double quote marks that are curved.  When these are cut and pasted into > the form and then pulled out to display, the HTML does not recognize the > characters and display's small boxes.  Is there a simple way to scrub my > database of these smart-aleck marks and replace them with their > straight-laced cousins and/or format my HTML so that it understands the > smarty pants curvy ones? Try this: http://www.cflib.org/udf.cfm?ID=725 ---------------------------- Massimo Foti Certified Dreamweaver MX Developer Certified Advanced ColdFusion MX Developer http://www.massimocorner.com/ ----------------------------

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dain Anderson
04/29/2003 11:09 AM

Hi Ian, Here's an adaptation I made to a script I found on CFLib.org used for converting those little buggers (it also handles the ellipsis character, the TM character MS uses, as well as the extended hyphen): In UDF format: function ConvertSpecialChars(textin) {    return ReplaceList(textin,"#Chr(8217)#,#Chr(8230)#,#Chr(8211)#,#Chr(8220)#,#Chr(822 1)#,#Chr(8482)#", "',...,--,"","",<SUP>TM</SUP>"); } -Dain > I've got an simple content management application where users cut and paste > text from MS word into form fields that are then inserted into a MS SQL 2000 > database.  Subsequently this text is pulled out of the database and > displayed in HTML pages to other users.  Pretty standard stuff. > > The trouble I'm having is with MS Word's smart quotes, those fancy single > and double quote marks that are curved.  When these are cut and pasted into > the form and then pulled out to display, the HTML does not recognize the > characters and display's small boxes.  Is there a simple way to scrub my > database of these smart-aleck marks and replace them with their > straight-laced cousins and/or format my HTML so that it understands the > smarty pants curvy ones? > > I'm hoping for a simple automated solution that I can apply globally so that > the poor content admin doesn't have to go back to the 100's of documents to ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Andre Mohamed
04/29/2003 11:10 AM

I believe there is a UDF on cflib.org that handles and strips Word's smart quotes under string functions? Check it out. André I've got an simple content management application where users cut and paste text from MS word into form fields that are then inserted into a MS SQL 2000 database.  Subsequently this text is pulled out of the database and displayed in HTML pages to other users.  Pretty standard stuff. The trouble I'm having is with MS Word's smart quotes, those fancy single and double quote marks that are curved.  When these are cut and pasted into the form and then pulled out to display, the HTML does not recognize the characters and display's small boxes.  Is there a simple way to scrub my database of these smart-aleck marks and replace them with their straight-laced cousins and/or format my HTML so that it understands the smarty pants curvy ones?   I'm hoping for a simple automated solution that I can apply globally so that the poor content admin doesn't have to go back to the 100's of documents to find and change each curvy single and double quote mark by hand. -------------- Ian Skinner Web Programmer BloodSource Sacramento, CA

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Mosh Teitelbaum
04/29/2003 11:16 AM

Check out the ConvertSpecialChars() UDF at:   http://www.cflib.org/udf.cfm?ID=319 You can use it to replace the MS Word characters or convert its logic to SQL and apply it with an UPDATE statement. -- Mosh Teitelbaum evoch, LLC Tel: (301) 942-5378 Fax: (301) 933-3651 Email: mosh.teitelbaum@evoch.com WWW: http://www.evoch.com/ ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Ryan Mitchell
04/29/2003 02:44 PM

I was looking for something similar myself, but I couldn¹t get this script to work in MX, any thoughts? On 29/4/03 4:10 pm, "Mosh Teitelbaum" <mosh.teitelbaum@evoch.com> wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Barney Boisvert
04/29/2003 02:52 PM

Those characters are ASCII 145-148 (two quotes, two double quotes).  You can easily do a search and replace on them to replace them with the proper codes.  Of course, you'll have to make sure your pulling data out of the DB in the right character set for this to work, and that's the tricky part. Best to do it on the insertion side, before inserting it into the database. barneyb --- Barney Boisvert, Senior Development Engineer AudienceCentral (formerly PIER System, Inc.) bboisvert@audiencecentral.com voice : 360.756.8080 x12 fax   : 360.647.5351 www.audiencecentral.com ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Mosh Teitelbaum
04/29/2003 02:54 PM

Well, the code for the UDF is pretty straight forward:   ReplaceList(textin, "#chr(145)#,#chr(146)#,#chr(147)#,#chr(148)#", "',',"",""") What sort of problems is it causing you in CFMX? -- Mosh Teitelbaum evoch, LLC Tel: (301) 942-5378 Fax: (301) 933-3651 Email: mosh.teitelbaum@evoch.com WWW: http://www.evoch.com/ ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Ryan Mitchell
04/29/2003 03:06 PM

Strange, I copied the text from your email and it worked... I guess it displayed wrong in my browser... Thanks Mosh. Ryan On 29/4/03 7:48 pm, "Mosh Teitelbaum" <mosh.teitelbaum@evoch.com> wrote: > ReplaceList(textin, "#chr(145)#,#chr(146)#,#chr(147)#,#chr(148)#", > "',',"",""")

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
E. Keith Dodd
04/29/2003 11:47 AM

In the app I have, people can copy/paste directly into textarea. I have a tag for the various chr's, but found I had to include replacing the actual characters before inserting into database table field. This took care of all the smart quotes. The MSRubbish is the original entry. (Adapted from Chris Tazewell's CleanMSText custom tag) (Don't know whether the actual curly stuff will show in this posted email.) MSRubbish = Replace(MSRubbish, '"', '"', 'all');   MSRubbish = Replace(MSRubbish, '"', '"', 'all');   MSRubbish = Replace(MSRubbish, "'", "'", 'all');   MSRubbish = Replace(MSRubbish, "'", "'", 'all'); E. Keith Dodd Wings of Eagles Services www.wingserv.com > I've got an simple content management application where users cut and paste > text from MS word into form fields that are then inserted into a MS SQL 2000 > database.  Subsequently this text is pulled out of the database and > displayed in HTML pages to other users.  Pretty standard stuff. > > The trouble I'm having is with MS Word's smart quotes, those fancy single > and double quote marks that are curved.  When these are cut and pasted into > the form and then pulled out to display, the HTML does not recognize the > characters and display's small boxes.  Is there a simple way to scrub my > database of these smart-aleck marks and replace them with their > straight-laced cousins and/or format my HTML so that it understands the > smarty pants curvy ones? > > I'm hoping for a simple automated solution that I can apply globally so that > the poor content admin doesn't have to go back to the 100's of documents to ----- Excess quoted text cut - see Original Post for more -----

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Snyder, Scott, A&M IRM
04/29/2003 02:53 PM

replace them with their decimal equivalents before inserting them into the DB.  I think they are       “ and ” I was looking for something similar myself, but I couldn¹t get this script to work in MX, any thoughts? On 29/4/03 4:10 pm, "Mosh Teitelbaum" <mosh.teitelbaum@evoch.com> wrote: > Check out the ConvertSpecialChars() UDF at: > http://www.cflib.org/udf.cfm?ID=319 > > You can use it to replace the MS Word characters or convert its logic to SQL ----- Excess quoted text cut - see Original Post for more -----


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

March 11, 2010

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
   1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31