I’m bringing some content from an Indesign file into my AS-S application and converting it to HTML. I’m having a problem with picking out the smart quotes in the string so I can convert them to the HTML tag equivalent (’ or ‘). When I view the HTML file in Safari the smart quotes come in as Õ. So eight o’clock appears as eight oÕclock. I’ve tried looking for a single quote ASCII (number 39) but that doesn’t pick it up and neither does putting a single quote in the search and replace subroutine. Any help would be appreciated.
-->this is dynamically pulled from indesign, hard coded here for an example
set thisStoryContents to "Oliver reached the stile at which the by-path terminated; and once more gained the high-road. It was eight o'clock now. Though he was nearly five miles away from the town, he ran, and hid behind the hedges, by turns, till noon: fearing that he might be pursued and overtaken. Then he sat down to rest by the side of the milestone, and began to think, for the first time, where he had better go and try to live."
set thisStoryContents to my searchAndReplace(ASCII character 39, "’", thisStoryContents)
set thisStoryContents to my searchAndReplace("'", "’", thisStoryContents)
on searchAndReplace(findThis, replaceWith, inString)
set AppleScript's text item delimiters to (findThis as string)
set theFilePathItems to every text item of (inString as string)
set AppleScript's text item delimiters to (replaceWith as string)
set theNewFolderPath to theFilePathItems as string
return theNewFolderPath
end searchAndReplace