bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: sort and Chinese numbers


From: Dan Jacobson
Subject: Re: sort and Chinese numbers
Date: 28 Jul 2001 04:19:16 +0800
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Thanks... I suppose the test with your program [that i compiled as vv]
shows there is a problem in the Mandrake 7.2 zh_TW.Big5 locale.

$ ./vv 4 3
>
$ LC_COLLATE=C ./vv 4 3
>
$ ./vv 4 5
>
$ LC_COLLATE=C ./vv 4 5
<
$ echo $LC_COLLATE
zh_TW.Big5
$ uname -a
Linux localhost.localdomain 2.2.17-21mdk #1 Thu Oct 5 13:16:08 CEST 2000 i586 
unknown

>>>>> "Paul" == Paul Eggert <address@hidden> writes:

>> 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
>> LC_COLLATE=zh_TW.Big5
>> 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.

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

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

int
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;
    }
  else
    {
      int i = strcoll (argv[1], argv[2]);
      if (i > 0) printf (">\n");
      if (i < 0) printf ("<\n");
      if (i == 0) printf ("==\n");
      return 0;
    }
}
-- 
http://www.geocities.com/jidanni/ Tel+886-4-25854780 積丹尼



reply via email to

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