Re: Replacing these chars
ok, that was supposed to be ampersandPound13Semicolon being replaced. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295547 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Replacing these chars
Two #'s should do it. If it's not working, you might be replacing them in the wrong place. What's the code look like in context? Adrian http://www.adrianlynch.co.uk/ -Original Message- From: Will Tomlinson Sent: 30 December 2007 18:06 To: CF-Talk Subject: Replacing these chars There's a problem with my xForm which causes it to output a ton of these in a textarea. #13; I'm trying to do a replace on it so they won't show up. #Replace(retProductInventory.prodlongdescription, ###13;,, All)# Doesn't work. One # throws an error. Two doesn't do anything. Three doesn't do anything either. When I view source, a bunch of #13; are still in the textarea output. Any ideas? Thanks, Will ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295548 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Replacing these chars
Two #'s should do it. If it's not working, you might be replacing them in the wrong place. What's the code look like in context? Adrian cfset chartoReplace = ##13; cftextarea name=prodlongdesc label=Long Description required=yes validate=noblanks validateat=onserver,onsubmit value=#replace(retProductInventory.prodlongdescription, charToReplace, , All)# cols=70 rows=10/cftextarea That still doesn't work. I get a bunch of the line breaks in the output, even when I delete them all before saving the form data. The more you save the form, the more of those chars it sticks in there. Then it ends up being riddled with a ton of them. G'day mate! Do you dig the Land Down Under and volleyball?#13; #13; Do you crave shrimp on the barbie and soft sets on the court?#13; #13; Well we've got the shirt for you! Wearing this will help you dig down and give it your best, with the Australian outline floating proudly above the mantra Dig down under... in small text below.lt;br /gt;lt;br /gt;#13; #13; ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295549 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Replacing these chars
-Original Message- From: Will Tomlinson [mailto:[EMAIL PROTECTED] Sent: Sunday, December 30, 2007 1:06 PM To: CF-Talk Subject: Replacing these chars There's a problem with my xForm which causes it to output a ton of these in a textarea. #13; Do you actually see this string? That's the character entity for a Carriage Return - like you get when you hit enter. I'm not sure why it would be in there but it's important - not just a string. I'm trying to do a replace on it so they won't show up. #Replace(retProductInventory.prodlongdescription, ###13;,, All)# If it's really carriage returns you want to replace you need to replace the character itself, not the code - something like this might work: #Replace(retProductInventory.prodlongdescription, chr(13),, All)# The chr() function takes the ASCII/UCS-2 decimal code for a character and returns the character. Again I'd also try to track down why your field is getting filled with carriage returns - stop that from happening and you don't need to replace anything. The officially unsupported TEXTAREA attribute wrap may have a lot to do with the insertion of carriage returns - are you using it? Jim Davis ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295550 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Replacing these chars
Will Tomlinson wrote: cfset chartoReplace = ##13; cftextarea name=prodlongdesc label=Long Description required=yes validate=noblanks validateat=onserver,onsubmit value=#replace(retProductInventory.prodlongdescription, charToReplace, , All)# cols=70 rows=10/cftextarea #replace(retProductInventory.prodlongdescription, charToReplace, , All)# Jochem ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295551 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Replacing these chars
Do you actually see this string? That's the character entity for a Carriage Return - like you get when you hit enter. Yes. When I view the source, those characters are in there. Each time you save the form, they keep building upon themselves. I'm not using wrap here, I'll give that a shot! Thanks jim Will ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295552 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Replacing these chars
cfset chartoReplace = ##13; cftextarea name=prodlongdesc label=Long Description required=yes validate=noblanks validateat=onserver,onsubmit value=#replace(retProductInventory.prodlongdescription, charToReplace, , All)# cols=70 rows=10/cftextarea #replace(retProductInventory.prodlongdescription, charToReplace, , All)# Ahhh yeah, this worked jochem! Thanks guy! Will ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295553 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Replacing these chars
What Jim said and, do you get them if you just output retProductInventory.prodlongdescription to screen? Adrian http://www.adrianlynch.co.uk/ -Original Message- From: Jim Davis Sent: 30 December 2007 19:03 To: CF-Talk Subject: RE: Replacing these chars -Original Message- From: Will Tomlinson Sent: Sunday, December 30, 2007 1:06 PM To: CF-Talk Subject: Replacing these chars There's a problem with my xForm which causes it to output a ton of these in a textarea. #13; Do you actually see this string? That's the character entity for a Carriage Return - like you get when you hit enter. I'm not sure why it would be in there but it's important - not just a string. I'm trying to do a replace on it so they won't show up. #Replace(retProductInventory.prodlongdescription, ###13;,, All)# If it's really carriage returns you want to replace you need to replace the character itself, not the code - something like this might work: #Replace(retProductInventory.prodlongdescription, chr(13),, All)# The chr() function takes the ASCII/UCS-2 decimal code for a character and returns the character. Again I'd also try to track down why your field is getting filled with carriage returns - stop that from happening and you don't need to replace anything. The officially unsupported TEXTAREA attribute wrap may have a lot to do with the insertion of carriage returns - are you using it? Jim Davis ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295556 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: replacing special chars
I put a couple of these solutions together. It worked great. Thank you everyone for your help. I found that chr(28) is not the actual code for left double quote copied from Word. It is the resulting code when we try to store the actual code, chr(8220), to our Oracle DB. To cover new and old data, we do a replacement on both. The full code we use is below. ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:242038 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=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: replacing special chars
Check out this UDF, http://www.cflib.org/udf.cfm?ID=725 ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:241779 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=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: replacing special chars
Check out this UDF, http://www.cflib.org/udf.cfm?ID=725 I don't know why, but that didn't seem to remove the odd characters. I tried adding my known problem char chr(28) but I suppose I didn't do it right because I saw no change in the text. I also tried adding some chars that I saw that it supposed to replace like ^ and (with amp;) but it didn't seem to do so. I'll continue to look it over to see if I did something wrong. ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:241792 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
Re: replacing special chars
I've used the following regex to remove non-ascii characters: cfset variables.content = REReplaceNoCase ( variables.content, [^\x00-\x7f], , ALL ) / Obviously, it can be tweaked to remove any ranges that you want include/exclude. On 5/31/06, daniel kessler [EMAIL PROTECTED] wrote: Check out this UDF, http://www.cflib.org/udf.cfm?ID=725 I don't know why, but that didn't seem to remove the odd characters. I tried adding my known problem char chr(28) but I suppose I didn't do it right because I saw no change in the text. I also tried adding some chars that I saw that it supposed to replace like ^ and (with amp;) but it didn't seem to do so. I'll continue to look it over to see if I did something wrong. ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:241799 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=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: replacing special chars
Daniel, I found that chr(28) is not the actual code for left double quote copied from Word. It is the resulting code when we try to store the actual code, chr(8220), to our Oracle DB. To cover new and old data, we do a replacement on both. The full code we use is below. Hope that helps, Jon !--- JG 02/26/06: replace non-printable characters that might invalidate XHTML --- cffunction name=CleanUnprintables returntype=string output=false access=public cfargument name=Text type=string required=true cfscript var Local = StructNew(); Local.Text = Arguments.Text; Local.Text = Replace(Local.Text, chr(11), , all); /* vertical tab */ Local.Text = Replace(Local.Text, chr(19), -, all); /* short dash from MS Word after saved to DB */ Local.Text = Replace(Local.Text, chr(20), --, all); /* long dash from MS Word after saved to DB */ Local.Text = Replace(Local.Text, chr(24), ', all); /* left single quote from MS Word after saved to DB */ Local.Text = Replace(Local.Text, chr(25), ', all); /* right single quote from MS Word after saved to DB */ Local.Text = Replace(Local.Text, chr(28), '', all); /* left double quote from MS Word after saved to DB */ Local.Text = Replace(Local.Text, chr(29), '', all); /* right double quote from MS Word after saved to DB */ Local.Text = Replace(Local.Text, chr(8211), -, all); /* short dash from MS Word */ Local.Text = Replace(Local.Text, chr(8212), --, all); /* long dash from MS Word */ Local.Text = Replace(Local.Text, chr(8216), ', all); /* left single quote from MS Word */ Local.Text = Replace(Local.Text, chr(8217), ', all); /* right single quote from MS Word */ Local.Text = Replace(Local.Text, chr(8220), '', all); /* left double quote from MS Word */ Local.Text = Replace(Local.Text, chr(8221), '', all); /* right double quote from MS Word */ return Local.Text; /cfscript /cffunction On 5/31/06, Daniel Kessler [EMAIL PROTECTED] wrote: I am trying to clean up some text that is entered into a form. The text usually comes from Word but also comes from other sources. I usually get a box instead of the char in this situation. I'm using an include that I pulled off of cflib and I'm trying to adjust it. The code is basically: function ConvertSpecialChars(textin) { return ReplaceList(textin, #chr(28)#,#chr(145)#,#chr(146)#,#chr(147) #,#chr(148)#, ',',',#chr(34)#,#chr(34)#); } I added the chr(28) which seems to be the left side of a smart quote from Word but this doesn't seem to be cleaning that out and replacing it with a single quote (though now I realize it should be a double- quote). Here's a test that I did that shows the bad char and it's number using asc(the_letter). Even though it goes through this cleaning, it still shows a the chr(28) char. In addition, though it doesn't show the bad right quote, when I go into the form to edit it, the invisible right quote is there and I can tell by moving the insertion point over letter by letter where it pauses at that spot. Anyhoo, why doesn't it replace this char and is there a better way of doing this? thanks and good morning (or whichever time you're at). _ Daniel Kessler College of Health and Human Performance University of Maryland Suite 2387 Valley Drive College Park, MD 20742-2611 Phone: 301-405-2545 http://hhp.umd.edu ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:241854 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