Re: Unicode, AppleScript, and the shell
Re: Unicode, AppleScript, and the shell
- Subject: Re: Unicode, AppleScript, and the shell
- From: John Delacour <email@hidden>
- Date: Wed, 23 Jul 2003 00:26:59 +0100
- Mac-eudora-version: 6.0a28
At 5:38 pm -0400 22/7/03, Sean McBride wrote:
Hi all,
I'm neither a Unicode nor AppleScript expert, so I'm hoping someone here
can help me.
I'm trying to use AppleScript and shell script to manipulate files with
non-ASCII characters (Japanese actually). Something like this:
set command to "/Developer/Tools/MvMac file folder"
do shell script command
If 'folder' has Japanese characters, how do I do this? Simply typing
Japanese results in question marks once I hit compile. :(
Select a folder with a Japanese name, paste this script into Script
Editor, click the event log button so you can see what happens and
run the script.
tell application "Finder"
get selection
item 1 of result
result as Unicode text
POSIX path of result
set f to quoted form of result
do shell script ("open " as Unicode text) & f
end tell
This will work also with names that cannot be converted into legacy
character sets, such as Lao and Polytonic Greek. So far as the file
system goes there is no "ascii"; everything is Unicode, so provided
you keep it that way, there is no problem. Pay special attention to
the name in the result you get from "get selection" -- this is the
utf-8 encoding used by the system.
There's no way to make it all clear in a few lines. You have to
learn by working with it, and it can be pretty confusing.
Never try to concatenate a 'string' (eg. "open ") with Unicode text.
JD
.
_______________________________________________
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.