>>It seems that `sort -d' behaves differently in Solaris 10 when
>>the input file contains 8-bit characters. This file:
> Hospital A
> Hospital! B
> H?spital C
> Hospital D
>>sorts without change in Solaris 9, but this way in Solaris 10:
Looking again, I'm not sure what collating order would do that - unless
for instance, sort is mangling the data so that '?' is treated identically
to 'o'.
Quote:> Hospital A
> Hospital! B
> Hospital D
> H?spital C
> I've inserted the two files with the original characters now.
>>We are using the en_CA.ISO8859-1 locale.
>>Does anyone know how `dictionary order' is supposed to behave in
>>this instance?
Assuming that it's based on the locale, as I noted one could write a program
using strcoll() to deduce the information. On this host (Solaris 8), I see
that 'o' is collated before the '?', which is consistent with Solaris 10.
141: 111 0x6f 0157 (o)
142: 211 0xd3 0323 ()
143: 243 0xf3 0363 ()
144: 210 0xd2 0322 ()
145: 242 0xf2 0362 ()
146: 212 0xd4 0324 (?)
147: 244 0xf4 0364 (?)
Here's the program (which does produce more output than quoted above).
You might try running that on the two systems to see if the program's
output is different - it might give some clues (or 'sort' in Solaris 9
might have not handled the comparison strictly according to locale).
/*
* Use strcoll() to display single-byte character values ordered in the current
* locale's collating order -T.Dickey 2005/3/19.
*/
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <limits.h>
#include <locale.h>
typedef unsigned char UChar;
static int
compare(const void *a, const void *b)
{
static char p[2];
static char q[2];
p[0] = *(const UChar *) a;
q[0] = *(const UChar *) b;
return strcoll(p, q);
Quote:}
int
main(void)
{
int ch;
unsigned char sorted[UCHAR_MAX + 1];
setlocale(LC_ALL, "");
for (ch = 0; ch < sizeof(sorted); ++ch)
sorted[ch] = ch;
qsort(sorted, sizeof(sorted) / sizeof(UChar), sizeof(UChar), compare);
for (ch = 0; ch < sizeof(sorted); ++ch) {
printf("%03u: %3u 0x%02x %#04o", ch, sorted[ch], sorted[ch], sorted[ch]);
if (isprint(sorted[ch]))
printf(" (%c)", sorted[ch]);
printf("\n");
}
return EXIT_SUCCESS;
Quote:}
--
Thomas E.*ey
http://www.veryComputer.com/
ftp://invisible-island.net