Re: Keychain Leopard->Tiger broken (unicode related?)
Re: Keychain Leopard->Tiger broken (unicode related?)
- Subject: Re: Keychain Leopard->Tiger broken (unicode related?)
- From: Christopher Nebel <email@hidden>
- Date: Fri, 16 Nov 2007 12:44:32 -0800
On Nov 16, 2007, at 9:11 AM, Loren Ryter wrote:
I posted this on MacScripter, apologies if it is bad form to post
here as
well. But I consider this a serious bug.
-------
Here's a crucial Keychain Scripting script that compiles and runs
fine on
Leopard but generates an error when moved to Tiger without
recompiling. If
you recompile it on Tiger then it works again!
set thekey to "some_existing_generic_key_name"
-- obviously you have to change thekey variable to an existing
generic key
on login.keychain
tell application "Keychain Scripting"
tell keychain "login.keychain"
set thekey to some generic key whose name = thekey
end tell
end tell
At first I thought it was an XCode (2.5) problem, but the same thing
happens
with script editor. I did find that compiling the AS Studio project
in
XCode 2.5 on Tiger and then running it on Leopard worked as
expected. But
I'm trying to stay in a Leopard development environment and this is
not fun.
I expect this has to to with Unicode text. My guess is that Keychain
Scripting on Tiger demands string classes rather than text or
unicode text
classes, and there is therefore no possible work around since
Leopard will
always compile «class TEXT» as unicode, if I understand this right.
Set a to "a" as string as text as unicode text:
set a to "a" as «class TEXT» as «class ctxt» as «class utxt»
As compiled on both Leopard and Tiger. But something is still amiss.
Is there any conceivable work-around to this problem?
If your guess is correct -- and it's a pretty good one -- then an
explicit "as string" would solve it:
set thekey to "some_existing_generic_key_name" as string
In Tiger, that will coerce the text constant (which is actually a
"Unicode text" object) to the old-style "string" object that Tiger
Keychain Scripting apparently wants. In Leopard, the "as string" does
nothing, but Leopard Keychain Scripting is apparently ok with that.
--Chris Nebel
AppleScript Engineering
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden