Re: Encoded file URL to Mac or Posix path...
Re: Encoded file URL to Mac or Posix path...
- Subject: Re: Encoded file URL to Mac or Posix path...
- From: "Mark J. Reed" <email@hidden>
- Date: Wed, 14 Mar 2007 09:47:41 -0400
On 3/13/07, Scott Babcock <email@hidden> wrote:
There's an easy way to do this without using scripting additions:
set fileURI to "file://localhost/Users/username/Desktop/éøu
¥"
set posixPath to (do shell script "perl -e 'use URI::file; print URI->new(\"" & fileURI & "\")->file;'")
--> "/Users/username/Desktop/????"
I would simplify the Perl a bit:
set posixPath to (do shell script "perl -MURI -e 'print URI->new(qq("
& fileURI & "))->file'")
I have the URI module OMM, but I'm not sure whether or not it's
bundled as part of the standard system Perl install.
kai: your Python snippet decodes the %xx stuff, but still returns a
string in URL format (file:///blah) instead of just a bare POSIX
path...
--
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