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

krizan at eset dot sk sourceware-bugzilla@sourceware.org
Fri Jan 13 14:47:00 GMT 2017


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.


More information about the Glibc-bugs mailing list