Handling Unicode Text
Handling Unicode Text
- Subject: Handling Unicode Text
- From: Mr Tea <email@hidden>
- Date: Fri, 02 Jan 2004 18:23:56 +0000
I've been exploring ways to transfer selected text from BBEdit to Script
Debugger. Getting the selection in BBEdit returns a reference; to make this
useable elsewhere, I needed to convert it to actual text - so, wanting to be
modern and up to date I tried getting the selection 'as Unicode text'.
Apparently, that wasn't a good idea, because when the Unicode text is
inserted into a script window it appears as a string, enclosed by quotation
marks, while if the same chunk of text is inserted as, um, ordinary text it
appears 'normally', ie, without the enclosing quotes.
Example: If I do this...
set s to "say \"I ate way too much Christmas pudding again.\"" as
Unicode text
tell application "Script Debugger"
make new window
set the contents of window 1 to s
end tell
...the text inserted into the script window is this...
"say \"I ate way too much Christmas pudding again.\""
...but if I leave out the coercion to Unicode (or append an empty string to
's' in the tell block), I get the result I want, which is...
say "I ate way too much Christmas pudding again."
I can see that it's useful for a script to have a way of storing text that
preserves niceties like escape characters, but it caught me by surprise on
this occasion.
Any comments?
Nick
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.