Unicode
Unicode
- Subject: Unicode
- From: Paul Berkowitz <email@hidden>
- Date: Sat, 30 Mar 2002 23:48:25 -0800
The release notes for AS 1.8.2b3 explain that text item delimiters now work
with Unicode text. And they do - it's great! They also say that in AS 1.8.1
and earlier, trying to do so could crash the application (running the
script, presumably). My own attempts in AS 1.6 or 1.8 resulted in an error
rather than a crash, I recall.
In any case, I would like to Unicode-ize a series of scripts I'm working on,
which do include a few tids operations. Naturally, it won't work with
Unicode until AS 1.8.2 is released, so in the meantime I'd like to
error-trap it so it will still work with regular strings. It will be getting
the starting Unicode from a UTF-8-aware application, so the trick is to
convert it if/when it hits this tids limitation.
The trouble is that both my computers have AS 1.8.2b3 - until very recently
I had one of them with OS 9.2.1/AS 1.6 , but Software Update beat me to the
punch. So I can't test for this.
I wonder if someone with "proper" Unicode in AppleScript (not the raw data
type in AS 1.3.7/1.4.3) but who does not have AS 1.8.2b3 installed: i.e. AS
1.5.5 through 1.8.1 (variously default OS 9.1, 9.2.1, 10.1.2, 10.1.3
installations) could run the following and see if it proceeds to its
conclusion:
-----------------------
set uniStr to "some text" as Unicode text
set AppleScript's text item delimiters to {" "}
try
set uniLs to text items of uniStr
set AppleScript's text item delimiters to {" extra "}
set newStr to uniLs as Unicode text
on error
set str to uniStr as string
set AppleScript's text item delimiters to {" "}
set ls to text items of str
set AppleScript's text item delimiters to {" extra "}
set newStr to ls as string
end try
set AppleScript's text item delimiters to {""}
newStr
-------------------
The result should be:
--> "some extra text"
Id appreciate any and all feedback. Many thanks.
(Incidentally, you can't use Unicode format for the actual text item
delimiter - it gets totally ignored. That's OK in my scripts, which mostly
use tab, return and suchlike. And it's great how easily Unicode and string
will concatenate to each either as one or the other as you see fit. But it
will still limit scripts using non-Mac Roman character formats, if the
delimiter can never be one or more of its own characters.)
--
Paul Berkowitz
_______________________________________________
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.