Re: Safari Download Folder?
Re: Safari Download Folder?
- Subject: Re: Safari Download Folder?
- From: "Mark J. Reed" <email@hidden>
- Date: Thu, 5 Mar 2009 09:36:33 -0500
On Thu, Mar 5, 2009 at 7:38 AM, Mark J. Reed <email@hidden> wrote:
>> --> "~/Documents/\\u30bf\\u3099\\u30a6\\u30f3\\u30ed\\u30fc\\u30c8\\u3099"
>
> That's not the wrong result, assuming the correct folder name is
> ダウンロード. It's just encoded using Java-style \u escapes.
>
> Unfortunately, expanding those is not as simple as do shell script
> echo. This will do the trick:
>
> do shell script "echo " & (quoted form of folderName) & " | perl -lne
> 's/\\\\u(.{4})/chr(hex($1))/ge; print glob($_); '"
Alternatively, Python understands the \u syntax natively, so the
command to use it is a bit simpler:
do shell script "python -c 'import os; print os.path.expanduser(u\"" &
folderName & "\".encode(\"utf-8\"))'"
--
Mark J. Reed <email@hidden>
_______________________________________________
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