Re: Do shell script and special characters
Re: Do shell script and special characters
- Subject: Re: Do shell script and special characters
- From: Matthew Stuckwisch <email@hidden>
- Date: Mon, 21 Oct 2002 21:33:20 -0500
- Allow an 'as' or 'encoding' parameter on do shell script so you can
specify what encoding, if any, you expect the result to be in if it's
not UTF-8 (this would include 'as data' so you could, for instance, cat
a .jpeg file and get the raw .jpeg in an AppleScript data object)
Advice welcome.
As others have mentioned, I think this would be the best way. If, say,
AppleScript internally were to store everything in one format (perhaps
Unicode?), then the following things would be very easy to work with:
set a to read POSIX file "/tmp/foo/bar" from MacBinary -- tell AS the
file is encoding use MacBinary
set b to do shell script "cat /tmp/foo/bar" from MacBinary -- tell AS
that shell script is reporting back using MacBinary
set c to do shell script ("cd
directoryWithAccentedCharacter/foo/bar;cat aFile" to UTF-8) from
MacBinary -- send the string as UTF8 for the shell script to use, then
interpret what the shell sends back as being MacBinary formatted
(likely it won't be, but for sake of example)
set d to write ... to Windows Latin I -- write a string to a text file
using Windows Latin I encoding
I think rather than limitting it to shell scripts, for many people it
could pretty useful to have as a general string, or at least
reading/writing documents command, would be beneficial to all scripters.
Matthew Stuckwisch
[AIM/MSN]{GuifaSwimmer} | [Yahoo!]{SapphireTree} | [ICQ]{137477701}
[IRC]{guifa}(esperNET / GamesNet) | [E-mail]{email@hidden}
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.