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

Bug#67205: locales: strcoll sorts incorrectly in sv_SE locale



Package: locales
Version: 2.1.3-10
Severity: wishlist

The Swedish standards say that the letters "V" and "W" should be considered
identical when sorting (this is used in all dictionaries, phone books etc.).

However, a small test program shows that glibc's locales do not think so:

$ ./sortme sv_SE
Using locale: sv_SE
0. Aasen
1. Asen
2. Väsen
3. Wasa
4. Åsen
5. Äsen
6. Ösen

Numbers 2 and 3 should be the other way around (i.e "Wasa" before "Väsen").

====[ sortme.c ]====
#include <string.h>
#include <stdio.h>
#include <locale.h>
#include <stdlib.h>

static int do_strcoll(const void *p1, const void *p2)
{
    return strcoll(*(const char **) p1, *(const char **) p2);
}

int main(int argc, char *argv[])
{
    char *words[] = { "Äsen", "Aasen", "Åsen", "Asen", "Ösen", "Väsen", "Wasa" };
    int i;

    if (argc < 2) return -1;
    printf("Using locale: %s\n", argv[1]);
    setlocale(LC_COLLATE, argv[1]);

    qsort((void *) words, 7, sizeof (char *), do_strcoll);
    for (i = 0; i < 7; i ++)
        printf("%d. %s\n", i, words[i]);
    return 0;
}
====[ sortme.c ]====

-- System Information
Debian Release: 2.2
Kernel Version: Linux perkele 2.2.15 #4 mån jul 10 20:50:07 CEST 2000 i586 unknown

Versions of the packages locales depends on:
ii  libc6               2.1.3-10            GNU C Library: Shared libraries and Timezone data



Reply to: