This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug locale/18927] Different strings should never collate as equal


https://sourceware.org/bugzilla/show_bug.cgi?id=18927

Matej Krizan <krizan at eset dot sk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |krizan at eset dot sk

--- Comment #12 from Matej Krizan <krizan at eset dot sk> ---
Hello,

let me resurrect this bugreport and stress the grave severity of it by another
example:

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

int main()
{
        setlocale(LC_ALL, "en_US.UTF-8");
        const char s1[] = "\343\202\244", s2[] = "\343\203\211";
        printf("%s\n%s\nstrcoll: %i\nstrcmp: %i\n", 
                        s1, s2, strcoll(s1, s2), strcmp(s1, s2));
        return 0;
}

which outputs (using glibc 2.24 on Fedora25):

イ
ド
strcoll: 0
strcmp: -1

meaning that *strcoll is unusable in any sane program*, because it can say that
different characters are equal in the (probably) most common en_US.UTF-8
locale.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]