[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sort and Chinese numbers

From: Paul Eggert
Subject: Re: sort and Chinese numbers
Date: Tue, 24 Jul 2001 16:32:17 -0700 (PDT)

> From: Dan Jacobson <address@hidden>
> Date: 14 Jul 2001 10:24:16 +0800
> >>>>> "Dan" == Dan Jacobson <address@hidden> writes:
> Dan> What is my problem? I tried sort(1) with all kinds of options and
> Dan> LC_COLLATE etc... but still can't get these wide numbers into order.
> Dan> sort (GNU textutils) 2.0
> [The screen shows wide square versions of the narrow ASCII 1 2 6 3 4 5 7]
> Wait, that was with
> but now with
> LC_COLLATE=C all the switches sort fine [but -m and -z, no big deal]
> gee, one would think that for proper behaviour in a zh_TW.Big5
> environment, one would want all the LC stuff set to zh_TW.Big5,
> but what do you know, if you want to sort Chinese numbers you got to
> turn them off.

That sounds like a bug in the LC_COLLATE locale on your host.
You can investigate this problem with the following little program.
Try invoking it with pairs of Chinese digits, in the zh_TW.Big5 locale.

#include <stdio.h>
#include <locale.h>
#include <string.h>

main (int argc, char **argv)
  if (argc != 3)
      fprintf (stderr, "%s: usage: %s string1 string2\n", argv[0], argv[0]);
      return 1;
  else if (! setlocale (LC_ALL, ""))
      fprintf (stderr, "%s: setlocale failed\n", argv[0]);
      return 1;
      int i = strcoll (argv[1], argv[2]);
      if (i > 0) printf (">\n");
      if (i < 0) printf ("<\n");
      if (i == 0) printf ("==\n");
      return 0;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]