• 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: Finding \t, \r, \n reliably
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Producing Unicode-only characters [was: Finding \t, \r, \n reliably]
      • From: kai <email@hidden>
    • Re: Finding \t, \r, \n reliably
      • From: Shane Stanley <email@hidden>
    • Re: Finding \t, \r, \n reliably
      • From: Emmanuel <email@hidden>
References: 
 >Re: Finding \t, \r, \n reliably (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: Do Shell Script
  • Next by Date: QuickTime - Save Export Settings - script help needed
  • Previous by thread: Re: What have I done? / do shell script mystery
  • Next by thread: Re: Finding \t, \r, \n reliably
  • Index(es):
    • Date
    • Thread