[Bug libc/22744] New: wcwidth glibc issue for 0x2630 Unicode character

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug libc/22744] New: wcwidth glibc issue for 0x2630 Unicode character

glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=22744

            Bug ID: 22744
           Summary: wcwidth glibc issue for 0x2630 Unicode character
           Product: glibc
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: illia.sechin at bk dot ru
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

$ cat test.c

#include <stdio.h>
#include <wchar.h>
#include <utf8proc.h>
int main() {
    wint_t c = 0x2630;
    printf("wcwidth returns %d\n", wcwidth(c));
    printf("utf8proc_charwidth returns %d\n", utf8proc_charwidth(c));
    return 0;
}

$ ./test
wcwidth returns -1
utf8proc_charwidth returns 2

So glibc in wcwidth() should return 2 for 0x2630 Unicode character.
More info:
https://github.com/source-foundry/Hack/pull/236#issuecomment-345040104

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug libc/22744] wcwidth glibc issue for 0x2630 Unicode character

glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=22744

Ilia Sechin <illia.sechin at bk dot ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |illia.sechin at bk dot ru

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug localedata/22744] wcwidth glibc issue for 0x2630 Unicode character

glaubitz at physik dot fu-berlin.de
In reply to this post by glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=22744

Joseph Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |libc-locales at sourceware dot org
          Component|libc                        |localedata

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug localedata/22744] wcwidth glibc issue for 0x2630 Unicode character

Sourceware - glibc-bugs mailing list
In reply to this post by glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=22744

nick black <nickblack at linux dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nickblack at linux dot com

--- Comment #1 from nick black <nickblack at linux dot com> ---
If I add a call to setlocale(LC_ALL, "") with a proper LANG environment
variable and installed locale data, I get the expected result (which is 1, and
agrees with modern utf8proc):

[schwarzgerat](0) $ cat test.c
#include <stdio.h>
#include <locale.h>
#include <wchar.h>
#include <utf8proc.h>
int main() {
  setlocale(LC_ALL, "");
  wint_t c = 0x2630;
  printf("wcwidth returns %d\n", wcwidth(c));
  printf("utf8proc_charwidth returns %d\n", utf8proc_charwidth(c));
  return 0;
}
[schwarzgerat](0) $ gcc -D_XOPEN_SOURCE test.c -lutf8proc
[schwarzgerat](0) $ ./a.out
wcwidth returns 1
utf8proc_charwidth returns 1
[schwarzgerat](0) $

I believe this bug can be closed. The test program provided requires a
setlocale() call to produce the expected result.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug localedata/22744] wcwidth glibc issue for 0x2630 Unicode character

Sourceware - glibc-bugs mailing list
In reply to this post by glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=22744

Andreas Schwab <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Andreas Schwab <[hidden email]> ---
Without setlocale, you are using the C locale, with the ASCII codeset.

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