Collation and sorting for French locales

Denis Barbier barbier@linuxfr.org
Wed Jan 5 23:14:00 GMT 2005


On Wed, Jan 05, 2005 at 08:18:16AM +0100, Denis Barbier wrote:
> I was quite surprised to find that sorting for French locales do
> not work as described in ISO 14651 and implemented in iso14651_t1.
[...]

It seems that rules were sometimes bound to a wrong section, the
attached patch seems to work fine.  Locales generated by a patched
localedef sort diacritics backward, as specified in iso14651_t1.
I will perform more tests and file a bugreport.

But it seems pretty odd to have this backward rule defined for all
locales, we surely want an easy way to turn it on and off.

Denis
-------------- next part --------------
Index: locale/programs/ld-collate.c
===================================================================
RCS file: /cvs/glibc/libc/locale/programs/ld-collate.c,v
retrieving revision 1.105
diff -u -r1.105 locale/programs/ld-collate.c
--- locale/programs/ld-collate.c	13 Jun 2003 20:50:24 -0000	1.105
+++ locale/programs/ld-collate.c	5 Jan 2005 23:07:48 -0000
@@ -1524,6 +1524,7 @@
   int i;
   int need_undefined = 0;
   struct section_list *sect;
+  enum coll_sort_rule *orules;
   int ruleidx;
   int nr_wide_elems = 0;
 
@@ -1535,17 +1536,28 @@
 				"LC_COLLATE"));
       return;
     }
+  if (nrules == 0)
+    {
+      /* An error message has already been printed:
+          empty category description not allowed.  */
+      return;
+    }
+
 
   /* If this assertion is hit change the type in `element_t'.  */
   assert (nrules <= sizeof (runp->used_in_level) * 8);
 
   /* Make sure that the `position' rule is used either in all sections
      or in none.  */
+  sect = collate->sections;
+  while (sect != NULL && sect->rules == NULL)
+    sect = sect->next;
+  orules = sect->rules;
   for (i = 0; i < nrules; ++i)
     for (sect = collate->sections; sect != NULL; sect = sect->next)
       if (sect->rules != NULL
 	  && ((sect->rules[i] & sort_position)
-	      != (collate->sections->rules[i] & sort_position)))
+	      != (orules[i] & sort_position)))
 	{
 	  WITH_CUR_LOCALE (error (0, 0, _("\
 %s: `position' must be used for a specific level in all sections or none"),
@@ -3190,6 +3202,7 @@
 			{
 			  sp->next = collate->current_section->next;
 			  collate->current_section->next = sp;
+			  collate->current_section = sp;
 			}
 		    }
 


More information about the Libc-locales mailing list