Re: Unicode text and the annoying relic called "styled text"
Re: Unicode text and the annoying relic called "styled text"
- Subject: Re: Unicode text and the annoying relic called "styled text"
- From: kai <email@hidden>
- Date: Wed, 22 Dec 2004 20:06:38 +0000
On Wed, 22 Dec 2004 20:23:03 +0100, jj wrote:
Here is my Arthur's version:
on AsPlainText(textual) --> Arthur Knapp
--
-- Where 'textual' values may include plain text,
-- 'international text', styled text, Pascal string,
-- C string, Unicode text, and =ABclass utf8=BB.
--
-- Unicode characters not having a single-byte
-- "mapping" come back as a question mark.
--
set {text:plainText} to textual as text
return plainText
end AsPlainText
Yeah, I've got that (later) version too. I don't quite understand it
yet.
;-) I'm not sure if it's meant to be better (more versatile), or just
shorter. Are there any cases where the first version won't work and
the
second will?
Being Arthur's code, most probably the recent version is faster than
the old
one, perhaps 10 ticks every 1000 runs. ;-)
I've always preferred to use it because it's both shorter and faster.
Scott's original 3 lines:
set utxt to "Foo" as Unicode text
set |TEXT| to utxt as string
set the clipboard to {string:|TEXT|, Unicode text:utxt}
- can still be expressed as 3 lines:
set utxt to "Foo" as Unicode text
set {text:|TEXT|} to utxt as string
set the clipboard to {string:|TEXT|, Unicode text:utxt}
... and, here, it's generally between 2-3 times faster than any method
involving a try block.
---
kai
_______________________________________________
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