Dealing with Rounded Quotation Marks

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
deeverd
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 165
Joined: Mon Jul 16, 2007 11:58 pm

Dealing with Rounded Quotation Marks

Post by deeverd » Tue May 20, 2014 5:47 pm

Hello Forum,

Seven years ago, I had asked and received a workable answer to a simple problem, yet now that same problem has come back to haunt me...

All I'm trying to do is to replace rounded quotation marks in a document with plain "quote" marks and doing so through rtfText so it doesn't wipe out the other formatting styles. I have placed the code I'm using below and it looks totally correct to me but the rounded quotation marks are continuing to stay rounded. Any good ideas are definitely appreciated.

Code: Select all

on mouseUp
   
   ###################
   # UN-FANCY QUOTES #
   ###################
   
   set the cursor to busy
   
   get the rtfText of field "importField"--Step #1 & 2
   put it into tQuoteMarks
   
   
   replace numToChar(147) with quote in tQuoteMarks--Step #3 (rounded left quotations marks)
   replace numToChar(148) with quote in  tQuoteMarks----Step #3 (rounded right quotations marks)
   
   
   set the rtfText  of field "importField" to tQuoteMarks--Step#4
   
   answer information "All done. Your quotes are no longer fancy." titled "Fancy Quotes are Gone"
   wait 5 ticks
   
end mouseUp

Thanks in advance,
deeverd

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: Dealing with Rounded Quotation Marks

Post by bn » Tue May 20, 2014 9:38 pm

Hi Deeverd,

I don't know nothing about RTF but looking at the rtfText it seems that rounded quotes are
\'D2
\'D3
replacing those in the rtfText with quote gives me regular quotes, I am on a Mac but that should be the same on Windows

here is a small stack that illustrates what I have done

Kind regards
Bernd
Attachments
replaceRoundedQuotesInRTF.livecode.zip
(1.66 KiB) Downloaded 188 times

deeverd
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 165
Joined: Mon Jul 16, 2007 11:58 pm

Re: Dealing with Rounded Quotation Marks

Post by deeverd » Tue May 20, 2014 10:14 pm

Hello Bernd,

Thank you very much! It's only been the past couple months that I have made myself become very familiar with HTML tags and a bit of CSS, but it hadn't dawned on me that RTF tags would be completely different. Actually, it also hadn't dawned on me that using "replace" this for that with RTF or HTML isn't always a literal replacement when it comes to certain symbols. I now understand.

I have just downloaded your stack and have no doubt that it answers my question perfectly.

Now, I need to do some research to understand RTF tags better.

Thanks again,
deeverd

BTW, I exited the forum to do a bit of searching and came up with the following excellent online resource for RTF tags:

http://www.biblioscape.com/rtf15_spec.htm

Hopefully, this will help anyone else seeking a good source of similar information.

Post Reply