Re: Finding \t, \r, \n reliably
Re: Finding \t, \r, \n reliably
- Subject: Re: Finding \t, \r, \n reliably
- From: Christopher Nebel <email@hidden>
- Date: Mon, 24 Oct 2005 09:42:10 -0700
On Oct 22, 2005, at 12:18 AM, Shane Stanley wrote:
On 22/10/05 9:53 AM, "Christopher Nebel" <email@hidden> wrote:
As scripting additions go, it's pretty cheap
... and nasty if you throw higher-code-point Unicode text at it.
Well, for some definition of "nasty". As a number of people have
pointed out, "ASCII number/character" are somewhat misnamed, as
they'll work on non-ASCII numbers/characters. ("ASCII" is only
defined from 0 to 127.) Precisely what they do with them, however,
is not documented anywhere.
In fact, what they do is give you the code point/character of the
input using your "primary" encoding. Exactly what this is is
determined by the first language in your International preferences,
but for most people reading here, it's MacRoman. (For a Japanese-
primary user -- hi, guys! -- it would be MacJapanese, which is almost
the same as Shift-JIS.) If you feed them something that's not
representable in that encoding -- say, an aleph in MacRoman -- the
results are not defined.
There is no official way to convert between Unicode code points and
characters in AppleScript, though there are workarounds using the
shell or an intermediate file. For example:
set e to do shell script "perl -e 'print \"\\x{3048}\"'" -->
hiragana letter e.
do shell script "perl -e 'use utf8; print ord(\"" & e & "\")'" --
> 12360
--Chris Nebel
AppleScript and Automator Engineering
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden