Re: Convert URL to text?
Re: Convert URL to text?
- Subject: Re: Convert URL to text?
- From: has <email@hidden>
- Date: Sun, 4 Dec 2005 21:56:29 +0000
Scott Dunn wrote:
>>>I'm trying to write a small utility that performs some actions based
>>><snip>
>>
>>Are you certain you actually need the URL as a string? Did you try passing keychain the original Unicode text value? While it's not unknown for some gnarly old pre-OS X applications to throw a fit when passed anything but a string,
>
>Had I been able to retrieve the key using the URL then I wouldn't have had a problem! Unfortunately the URL is of type 'utxt',
That's the code for 'Unicode text', which is what modern applications normally provide. Sounds like Keychain Scripting.app is one of those aforementioned nasty old pre-OS X relics that has completely failed to get with the times. You should go file a bug on it.
>>Here's a wild guess: you haven't checked to see what the URL strings returned by Safari actually look like.
>Sorry, your guess is wrong ;-)
Therein lies one of the hazards of not providing as much information as you can (actual code, exact error messages, etc.) when you pose a question here. :)
BTW, note that tricks like 'set {text:keyName} to theURL as text' to convert Unicode text to string are not guaranteed to be reliable. If the Unicode value contains only ASCII characters and your primary encoding (which is what unstyled strings go by) is a superset of ASCII then you shouldn't have problems, but beyond that things get really dodgy. If you need a more robust solution, TextCommands' <http://osaxen.com/files/textcommands1.0.1.html> "convert from unicode" command allows you to specify the target encoding and how to deal with untranslateable characters.
HTH
has
--
http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden