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

Bug#557880: libc6: nl_langinfo ALT_DIGITS and ERA not posix compliant



Package: libc6
Version: 2.10.1-3
Severity: normal

With a ja_JP.UTF8 locale defined, the program foo.c below prints

    E3 80 87 00 E4 B8 80 00 E4 BA 8C 00

where I expected the 00 null bytes to be semi-colons, separating the
symbols for the alt digits, per POSIX

    http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html#tag_07_03_05_02

which says

    The value consists of semicolon-separated symbols.

(Semi-colon is also the separator in the locale definition file, but
that's a separate thing.  That chapter of the spec has separate sections
for the file format and the subsequent C-language access.)

I believe the same problem is present in nl_langinfo(ERA).  The spec is
"Era description segments are separated by semicolons", but the libc
code ends up giving '\0' separators.

#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <langinfo.h>

int
main (void)
{

  char *s;
  int i;
  const char *locale = "ja_JP.UTF8";

  if (setlocale (LC_ALL, locale) == NULL) {
    printf ("no locale %s\n", locale);
    exit (1);
  }

  s = nl_langinfo (ALT_DIGITS);
  /* printf ("ALT_DIGITS `%s'\n", s); */

  for (i = 0; i < 12; i++) {
    printf (" %02X", (int) (unsigned char) s[i]);
  }
  printf ("\n");

  return 0;
}


-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i586)

Kernel: Linux 2.6.30-1-486
Locale: LANG=en_AU, LC_CTYPE=en_AU (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/dash

Versions of packages libc6 depends on:
ii  libc-bin                      2.10.1-3   GNU C Library: Binaries
ii  libgcc1                       1:4.4.2-3  GCC support library

Versions of packages libc6 recommends:
pn  libc6-i686                    <none>     (no description available)

Versions of packages libc6 suggests:
ii  debconf [debconf-2.0]         1.5.28     Debian configuration management sy
ii  glibc-doc                     2.10.1-5   GNU C Library: Documentation
ii  locales                       2.10.1-5   GNU C Library: National Language (

-- debconf information:
* glibc/upgrade: true
  glibc/disable-screensaver:
  glibc/restart-failed:
* glibc/restart-services: rsync openbsd-inetd exim4 cron atd

Reply to: