Trouble with Unicode text
Trouble with Unicode text
- Subject: Trouble with Unicode text
- From: Jeffrey Mattox <email@hidden>
- Date: Wed, 26 Feb 2003 17:32:05 -0600
I have a string that has been fetched from a text field (AppleScript
Studio), and I'm iterating though the string character by character.
Sometimes, the string contains Greek characters, e.g., (sigma, Option-w).
Inside the loop, I test each character and am looking for a sigma,
but the test always fails.
I've narrowed the problem down to this:
When I get the input string via the text field, a sigma looks like:
log(theChar) -- "\\u2211"
log((class of theChar) as string) -- "Unicode text"
log(length of theChar) -- 1
When I temporarily set my input string to a sigma, or when I test for
the character sigma inside my loop, the sigma is coded this way:
set theChar to "" as string
log(theChar) -- "\\u201a\\340\\353"
log((class of theChar) as string) -- "string"
log(length of theChar) -- 3
set theChar to "" as Unicode text
log(theChar) -- "\\u201a\\340\\353"
log((class of theChar) as string) -- "Unicode text"
log(length of theChar) -- 3
As a side effect of this, my repeat loop fails too, this way
So, (1) why doesn't my sigma look anything like the sigma from my
text field, even when coerced to Unicode text, and (2) why is the
length of my Unicode sigma 3?
As they say, this used to work and then suddenly, without warning,
and of course I didn't change anything :-), it stopped. I was
fiddling with TIDs, but I don't see how that matters.
Jeff
_______________________________________________
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.