• 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: AppleScript strings fail
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AppleScript strings fail


  • Subject: Re: AppleScript strings fail
  • From: has <email@hidden>
  • Date: Wed, 29 Oct 2008 23:37:57 +0000

Axel Luttgens wrote:

FYI,

"1" < "@"
--> false

This returned 'true' a few months ago; now it returns 'false'.

On the Jaguar machine I'm at at the moment, it returns 'true' if the items are strings and 'false' if they're Unicode text.

Same here when trying on a Tiger box.

Sounds like I must've been running AS 1.x on 10.4 at the time; I'm currently on 10.5. The text in question was defined as string literals, so would behave as classic AS strings on one and new-style Unicode strings on the other.



The Unicode
behaviour must be wrong.

Maybe not: this is perhaps just a matter of differing collations (say, a POSIX collation vs the Unicode collation algorithm).

Here, with Leopard, a quick experiment leads to the following ordering
for characters 32 to 127:

 `^_-,;:!?.'\"()[]{}@*/\\&#<=>|~
$0123456789aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ

This is very similar to the order that would be adopted in the Finder
for displaying items sorted by name.

Just rough guesses...

I suspect your guess is the right one, particularly given AppleScript's traditional propensity for localising other stuff like decimal separators and date formats. ASLG 2.0 would appear to back this up in the operators chapter, albeit without really saying what the actual implications are for developers and users:


"To determine the ordering of two text objects, AppleScript uses the collation order set in the Language pane of International preferences. A text object is greater than (comes after) another text object based on the lexicographic ordering of the user’s language preference."

Which I'm guessing is probably a polite way of saying it's a complete crapshoot what'll happen when other people try to run your scripts. <sigh>

Thanks to all that replied,

has
--
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net

_______________________________________________
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
  • Prev by Date: Re: Ejecting An Image Disk
  • Next by Date: Re: Ejecting An Image Disk
  • Previous by thread: Re: AppleScript strings fail
  • Next by thread: Ma always said: there is a time to take and a time to give [Mid(Source, Start, End)]
  • Index(es):
    • Date
    • Thread