Problem
I've set my locale to use a foreign language or character set on SCO OpenServer 5.0.2. The sort(C), tr(C), ls(C) and other utilities are not sorting numbers in the correct order.
Solution
You might expect the data to be sorted in C/ASCII order, but
the data is now being sorted in country specific order. This is
the correct behavior for the system.One solution to this problem is to set your LC_COLLATE environment
variable to C. This will allow you to continue using the operating
system in a foreign language, but use the standard POSIX defined
collation sequence for sorting:LC_COLLATE=C
export LC_COLLATEThe above could be added either to the /etc/profile or the .profile of individual users.
Another solution would be to replace the collation table with
a newer one. Included at the end of this document is an updated
8859 collation table which more closely resembles the standard
POSIX C collation table. Save this new collation table to the
following file:/usr/lib/lang.src/col.8859-new.srcOnce this is done, run the coltbl(M) utility on this file which
will compile a 'collate' file in the same directory. For example:# coltbl col.8859-new.srcCopy the resulting 'collate' file to the relevant language directory in:
/usr/lib/lang/For example, if your LANG variable is german_germany.8859, you
would copy the 'collate' file to:/usr/lib/lang/german/germany/8859/collate----------X cut here X----------------X cut here X--------------------------# Copyright (C) 1987-1996 The Santa Cruz Operation, Inc.
#
ZERO: '-' 0xad 0x27 # Hyphens and apostrophe ignored
PRIM: 1 - 0x1f 0x7f - 0x9f # Control characters
PRIM: ' ' 0xa0 # Spacing
PRIM: '.' ':' ';' ',' '!' '?' 0xa1 0xbf # Punctuation
PRIM: '0' # Digits
PRIM: '1' # Digits
PRIM: '2' # Digits
PRIM: '3' # Digits
PRIM: '4' # Digits
PRIM: '5' # Digits
PRIM: '6' # Digits
PRIM: '7' # Digits
PRIM: '8' # Digits
PRIM: '9' # Digits
PRIM: '"' -'&' '(' - '+' '/' '<' - '>' '@' '[' - '`' '{' - '~' 0xa2 - 0xac 0xae-0xbe 0xd7 0xf7 # Remaining symbols
PRIM: 'a' 0xe0 - 0xe5 'A' 0xc0 - 0xc5
PRIM: 'b' 'B'
PRIM: 'c' 0xe7 'C' 0xc7
PRIM: 'd' 'D'
PRIM: 'e' 0xe8 - 0xeb 'E' 0xc8 - 0xcb
PRIM: 'f' 'F'
PRIM: 'g' 'G'
PRIM: 'h' 'H'
PRIM: 'i' 0xec - 0xef 'I' 0xcc - 0xcf
PRIM: 'j' 'J'
PRIM: 'k' 'K'
PRIM: 'l' 'L'
PRIM: 'm' 'M'
PRIM: 'n' 0xf1 'N' 0xd1
PRIM: 'o' 0xf2 - 0xf6 0xf8 'O' 0xd2 - 0xd6 0xd8
PRIM: 'p' 'P'
PRIM: 'q' 'Q'
PRIM: 'r' 'R'
PRIM: 's' 'S'
PRIM: 't' 'T'
PRIM: 'u' 0xf9 - 0xfc 'U' 0xd9 - 0xdc
PRIM: 'v' 'V'
PRIM: 'w' 'W'
PRIM: 'x' 'X'
PRIM: 'y' 0xfd 'Y' 0xdd
PRIM: 'z' 'Z'
PRIM: 0xf0 0xd0 # Icelandic eth
PRIM: 0xfe 0xde # Icelandic thorn
DOUBLE: 0xe6 = ('a' 'e') # ae ligature
DOUBLE: 0xc6 = ('A' 'E') # AE ligature
DOUBLE: 0xdf = ('s' 's') # sharp ss
DOUBLE: 0xff = ('i' 'j') # Flemish ij
----------X cut here X----------------X cut here X--------------------------