Re: Applescript UTF-8 and do shell script
Re: Applescript UTF-8 and do shell script
- Subject: Re: Applescript UTF-8 and do shell script
- From: Sander Tekelenburg <email@hidden>
- Date: Mon, 3 Aug 2009 17:15:30 +0200
At 18:44 -0700 UTC, on 2009-07-30, John Mistler wrote:
> I have been told that Applescript 2.2.1 is fully UTF-8 compliant.
You probably mean "fully Unicode compliant". Unicode is a character
repertoire[*]. It can be encoded in several ways, of which utf-8 and utf-16
are the most common. By default, Mac OS-X uses utf-16. If you want to write
as utf-8 (for HTML documents, for instance), you'll need to state so
explicitly.
[*] The common term is "character set", but because in HTTP and other
environments the keyname "charset" is used to indicate an *encoding*, not a
character set, some of us prefer to use the term "character repertoire", in
the vain hope that this may one day help someone somewhere to be a little
less confused.
[...]
>tell application "iTunes" to set theArtist to artist of track 1 of playlist "TestUTF8" --
>theArtist = Beyoncé
> do shell script "touch ~/Desktop/result.txt"
> do shell script "echo " & theArtist & " >> ~/Desktop/result.txt"
> --> result.txt file contains a garbled character --> Beyonc©
Works fine for me. But as Shane suggested, when something is encoded as x,
you'll need to decode it as x -- make sure that whatever you'r reading the
file with is doing the right thing.
--
Sander Tekelenburg, <http://www.euronet.nl/~tekelenb/>
_______________________________________________
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