• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Getting Info from the Finder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting Info from the Finder


  • Subject: Re: Getting Info from the Finder
  • From: "Mark J. Reed" <email@hidden>
  • Date: Wed, 19 May 2010 11:42:24 -0400

On Wed, May 19, 2010 at 11:09 AM, Thomas Fischer <email@hidden> wrote:
> Hi Mark,
> I didn't find any way to evaluate \U00A9 directly, but at least I can
> convert from hex number X to decimal number Z using
> do shell script ("printf \"%d\" 0x" & X)
> Unfortunately, printf seams to be completely unaware not only of Unicode,
> but of any characters beyond ASCII 127:
> e.g.
> printf "%b" "\x7e" -> ~
> but
> printf "%b" "\xe4" -> ?

Well, that outputs exactly what you asked for - the one-byte value
0xe4.  Which would work if you were using a one-byte character set
like Latin-1 or MacRoman.  But for Unicode it doesn't work.

Python Unicode strings (u'...') understand the \u syntax, so they work
well here, e.g.:

set myString to someStringReturnedFromMdLS
do shell script "python <<EOF" & linefeed & "print u" & quoted form of
myString & ".encode('utf-8')"

(You'll have to manually set linefeed to ascii character 10 on
pre-Leopard systems).

--
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

  • Follow-Ups:
    • Re: Getting Info from the Finder
      • From: Thomas Fischer <email@hidden>
References: 
 >Getting Info from the Finder (From: Thomas Fischer <email@hidden>)
 >Re: Getting Info from the Finder (From: Martin Michel <email@hidden>)
 >Re: Getting Info from the Finder (From: Thomas Fischer <email@hidden>)
 >Re: Getting Info from the Finder (From: Luther Fuller <email@hidden>)
 >Re: Getting Info from the Finder (From: Thomas Fischer <email@hidden>)
 >Re: Getting Info from the Finder (From: Tommy Bollman <email@hidden>)
 >Re: Getting Info from the Finder (From: "Mark J. Reed" <email@hidden>)
 >Re: Getting Info from the Finder (From: Thomas Fischer <email@hidden>)

  • Prev by Date: Re: User interface options besides AppleScript Studio?
  • Next by Date: Re: User interface options besides AppleScript Studio?
  • Previous by thread: Re: Getting Info from the Finder
  • Next by thread: Re: Getting Info from the Finder
  • Index(es):
    • Date
    • Thread