Re: Getting Info from the Finder
Re: Getting Info from the Finder
- Subject: Re: Getting Info from the Finder
- From: Thomas Fischer <email@hidden>
- Date: Thu, 20 May 2010 13:57:56 +0200
Hi Mark any Tommy,
Am 19.05.2010 um 17:42 schrieb Mark J. Reed:
> 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.
I would expect
printf "%b" "\x3f" -> ?
the sign "?" as indicator for non identified character is a little problematic.
> Which would work if you were using a one-byte character set
> like Latin-1 or MacRoman. But for Unicode it doesn't work.
I think it is a sign of shortcomings on the side of the shell.
If my text editor required to type "ä" every time I need an "ä", I would discard it quickly.
But this is exactly what the shell does:
printf "%b" "\xC3\xA4" -> ä
There are other shells, which behave better, e.g. the Z shell zsh:
printf "%b" "\u00E4\n" -> ä
(Without the \n zsh creates some very strange output, something like dozens of spaces stacked on top of each other.)
or for that matter even easier:
print "\u00E4" -> ä
You can obtain this result from the standard shell using e.g.
echo 'print \"TeX \\U00A9 output 2008.01.24\"'|zsh ->
"TeX © output 2008.01.24"
So I thought I was home free, but alas:
do shell script "echo 'print \"TeX \\U00A9 output 2008.01.24\"'|zsh" ->
"TeX "
Everything from the \U00A9 onward vanishes!
So I keep on looking for better solutions.
Tommy's hint didn't seem to work for me.
Thomas
_______________________________________________
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