Replace Quotes with Escaped Quotes in String

Peter TB Brett peter.brett at livecode.com
Wed Dec 16 10:17:11 EST 2015


On 16/12/2015 15:00, Brahmanathaswami wrote:
> Sorry but this did not work:
>
> replace "'" with "\'" in tBody
> put merge("echo '[[tBody]]' | ") into tCmd
> put format ("mail -s \"Visitor Care Notice\" -r \"No-Reply at hindu.org\" "
> & tAddresses) after tCmd
> get shell(tCmd)
>
> tBody = Peter is visiting Kauai from Scotland. He says "It's a great
> day...Finally I get a break from coding and get to leave this island in
> the northern hinterland and go to another one in the Pacific Blue."
>
> email arrives with quotes stripped out.
 >
> Peter is visiting Kauai from Scotland. He says It's a great
> day...Finally I get a break from coding and get to leave this island in
> the northern hinterland and go to another one in the Pacific Blue.

How curious.  No idea what's going on there, sorry.  Try using open 
process and writing the data to it directly, rather than messing about 
with shell escaping!

> Back the first question: how do we replace double quotes in a field or
> variable?
>
> put format ("\"") into tEscapedQuote
> replace quote with tEscapedQuote

replace quote with backslash & quote in tContainer

                                           Peter

-- 
Dr Peter Brett <peter.brett at livecode.com>
LiveCode Open Source Team

LiveCode on reddit: https://reddit.com/r/livecode




More information about the use-livecode mailing list