Important: The information in this document is obsolete and should not be used for new development.
Standard Sorting Routines
The standard Macintosh sorting routines are contained in the Pack 6 resource, a system code resource (type ='PACK'
, ID = 6) initialized at startup. As they process each character or sorting unit, the standard routines first call equivalent routines in the current script system's string-manipulation ('itl2'
) resource. Those routines, called sorting hooks, are described with the string-manipulation resource in the appendix "International Resources" in this book.The U.S. string-manipulation (
'itl2'
) resource contains only empty sorting hooks. Other localized versions of the Roman script system--and non-Roman script systems--provide their own string-manipulation resources that may have nonempty routines to modify or replace any of the standard routines, on a character-by-character basis.Table A-8 describes the sorting behavior implemented by the standard Macintosh sorting routines. All characters of the Standard Roman character set are sorted. Primary sorting is shown in vertical order; secondary sorting is horizontal. This is the default sorting behavior used by the Text Utilities, and is appropriate for U.S. and similar localized versions of the Roman script system. All Text Utilities sorting routines (other than
RelString
andEqualString
) use the sorting behavior specified in the string-manipulation resource, which may or may not be identical to the standard behavior. (RelString
andEqualString
use an invariant sorting behavior that is described in the chapter "Text Utilities" in this book.)Low-ASCII characters (other than letters) not listed in Table A-8 have primary sorting only and are sorted according to numeric code. Low-ASCII letters not listed in Table A-8 have a primary sorting order that is alphabetical and a secondary sorting order of uppercase followed by lowercase (like "B b"). All characters with codes above $A0 that are not listed in Table A-8 are sorted after $A0 according to numeric character code (except for ligatures; see note on sorting of ligatures).
Note the following details and anomalies in the standard Macintosh sorting order:
- The symbols \x81 ($BB) and \x86 ($BC) are explicitly treated as symbols, not as letters, and their primary sorting positions are not respectively the same as A and O.
- The en-dash ($D0) and em-dash ($D1) do not have the same primary sorting position as hyphen-minus ($2D).
- The double low quotation mark ,, ($E3) does not have the same primary sorting position as quotation " ($22).
- The single low quotation mark , ($E2), and the left and right single guillemet <\xDD> ($DC, $DD) do not have the same primary sorting position as apostrophe ' ($27).
- The secondary sorting position for dotless-lower-i \xFB ($F5) is indeterminate. It sorts at exactly the same place (primary and secondary order) as regular lower i ($69).
- The character \xE7 does not sort between Y and y.
- Sorting of ligatures
- For a ligature, the primary sorting position is equivalent to the separate characters that make up the ligature. The secondary sorting position is just following the equivalent separate characters. Ligatures are sorted by the following first and second characters:
Ligature First
characterSecond
characterÆ A E æ a e \xDE f i \x9C f l \xEB O E \xB6 o e ß s s