Re: convert unicode text to code point
Re: convert unicode text to code point
- Subject: Re: convert unicode text to code point
- From: has <email@hidden>
- Date: Mon, 16 Jan 2006 13:25:03 +0000
bill wrote:
>Last week I re-read an old thread "Re: Producing Unicode-only
>characters"
[...]
>Well, I tried to use repeat loop to simulate the function of ASCII
>number, however, the speed is very slow. Hope someone on the list can
>improve this one, and make it a vanilla method :)
Um, obvious question: why? AS is completely useless for this kind of data crunching, and the sensible solution is to hand it to a third-party to deal with (something AS _is_ good at). It's a well-solved problem everywhere else. Is there a particular reason you can't use a scriptable application, osax, Cocoa method or shell script to do it? They're far simpler and quicker, and don't involve evil bug-exploiting hacks. Examples:
tell application "TextCommands"
pack (convert from unicode txt to "utf16") using hex encoding
end tell
--> "feff60b20000d87eddf4"
do shell script "xxd -p < " & quoted form of POSIX path of tempFile -- a UTF16-encoded file [1]
Regards,
has
[1] Yes, having to write temp files just to feed stdin sucks. Feel free to file a feature request on the 'do shell script' command, asking for an optional 'with data' parameter to pass stdin data directly. It's long overdue.
--
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