This question is related to this post: http://bbs.applescript.net/viewtopic.php?id=15395
Some background:
I want to be able to represent a space character, in both text fields and table views, as another character. Originally I was using «data utxt25B4» (a small black triangle) for my space character representation. When getting the data from the table view that character would return as a “?” character. I couldn’t find a way to distinguish that from an actual question mark.
I have changed the space resprentation character to «data utxt02D0» (a triangle colon character). When I get the data from the table view this character shows up as “¢âˆž”.
The following code works in both Script Editor and Smile. It does not work in Xcode:
on snr(theString, searchString, replaceString)
set {oTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, {searchString}}
set theString to theString's text items
set AppleScript's text item delimiters to replaceString
set theString to theString's text items as text
set AppleScript's text item delimiters to oTID
return theString
end snr
(*
theString = "¢âˆž¢âˆž"
searchString = "¢âˆž"
replaceString = " " --> a single space character
*)
-- this code has been adapted from code originally posted by jonn8. I made this code "less elegant" in hopes of making it work in this situation.
When this code is ran in Script Editor and Smile, like I said above, it works. When I run it in the Xcode debugger the line:
set theString to theString's text items
returns: {“¢âˆž¢âˆž”} instead of {“”, “”, “”} like it does in the other apps. mentioned. Any thoughts on how to resolve this?
Thanks in Advance,
Brad Bumgarner, CTA