--- coreutils-7.1/src/join.c.bak 2008-11-10 14:17:52.000000000 +0100 +++ coreutils-7.1/src/join.c 2009-03-10 03:48:45.000000000 +0100 @@ -1,5 +1,5 @@ /* join - join lines of two files on a common field - Copyright (C) 91, 1995-2006, 2008 Free Software Foundation, Inc. + Copyright (C) 91, 1995-2006, 2008-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,6 +25,9 @@ #include "system.h" #include "error.h" #include "linebuffer.h" +#include "unicase.h" +#include "uninorm.h" +#include "mbmemcasecmp.h" #include "memcasecmp.h" #include "quote.h" #include "stdio--.h" @@ -92,6 +95,9 @@ want to overwrite the previous buffer before we check order. */ static struct line *spareline[2] = {NULL, NULL}; +/* True if the LC_CTYPE locale is hard. */ +static bool hard_LC_CTYPE; + /* True if the LC_COLLATE locale is hard. */ static bool hard_LC_COLLATE; @@ -321,8 +327,23 @@ if (ignore_case) { - /* FIXME: ignore_case does not work with NLS (in particular, - with multibyte chars). */ + if (hard_LC_CTYPE) + { +#if EXTRA_I18N + /* The ulc_casecmp function handles not only multibyte characters + correctly, but also the German sharp s, the Greek final sigma, + the Turkish dotless i, etc. */ + if (ulc_casecmp (beg1, len1, beg2, len2, uc_locale_language (), + UNINORM_NFD, &diff) >= 0) + return diff; + if (errno == ENOMEM) + xalloc_die (); +#endif + /* IF ulc_casecmp failed due to some conversion error, fall back to + a comparison that at least handles multibyte characters and the + Turkish dotless i correctly. */ + return mbmemcasecmp (beg1, len1, beg2, len2); + } diff = memcasecmp (beg1, beg2, MIN (len1, len2)); } else @@ -942,6 +963,7 @@ setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + hard_LC_CTYPE = hard_locale (LC_CTYPE); hard_LC_COLLATE = hard_locale (LC_COLLATE); atexit (close_stdout); --- coreutils-7.1/bootstrap.conf.bak 2009-02-16 14:35:18.000000000 +0100 +++ coreutils-7.1/bootstrap.conf 2009-03-10 03:52:46.000000000 +0100 @@ -67,6 +67,7 @@ inttostr inttypes isapipe lchmod lchown lib-ignore linebuffer link-follow long-options lstat malloc + mbmemcasecmp mbrtowc mbswidth memcasecmp mempcpy @@ -96,7 +97,9 @@ strdup strftime strpbrk strtoimax strtoumax strverscmp sys_stat timespec tzset - unicodeio unistd-safer unlink-busy unlinkdir unlocked-io + unicase/ulc-casecmp unicase/locale-language + unicodeio uninorm/nfd + unistd-safer unlink-busy unlinkdir unlocked-io uptime useless-if-before-free userspec utimecmp utimens