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

Bug#495494: marked as done (nl_langinfo() returns ANSI_X3.4-1968 instead of UTF-8)



Your message dated Mon, 18 Aug 2008 02:37:51 +0200
with message-id <20080818003751.GB28163@volta.aurel32.net>
and subject line Re: Bug#495494: nl_langinfo() returns ANSI_X3.4-1968 instead of UTF-8
has caused the Debian Bug report #495494,
regarding nl_langinfo() returns ANSI_X3.4-1968 instead of UTF-8
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
495494: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=495494
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: libc6-i686
Version: 2.7-13
Severity: normal

Hello,

It seems my machine can't make up its mind as to what charset is being used.
Most things seem convinced that it is UTF-8:

$ grep -v ^# /etc/locale.gen | grep -v ^$
en_US.UTF-8 UTF-8
$ grep -v ^# /etc/default/locale | grep -v ^$
LANG=en_US.UTF-8
$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE=C
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
$ locale charmap
UTF-8
$ localedef --list-archive
en_US.utf8


However, nl_langinfo(CODESET) returns ANSI_X3.4-1968:


$ cat test.c
#include <stdio.h>
#include <langinfo.h>

int main(int argc, char *argv[])
{
  printf("%s\n", nl_langinfo(CODESET));
  return 0;
}
$ gcc test.c -o test
$ ./test
ANSI_X3.4-1968


Why would nl_langinfo() be different than everything else and how can I
fix this?  Note that the manpage specifies that it should return the same
string as `locale charmap` -- that is obviously not the case here.

Thanks,
--Joe

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (990, 'unstable'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-1-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libc6-i686 depends on:
ii  libc6                         2.7-13     GNU C Library: Shared libraries



--- End Message ---
--- Begin Message ---
On Sun, Aug 17, 2008 at 07:53:18PM -0400, Joe Nahmias wrote:
> Package: libc6-i686
> Version: 2.7-13
> Severity: normal
> 
> Hello,
> 
> It seems my machine can't make up its mind as to what charset is being used.
> Most things seem convinced that it is UTF-8:
> 
> $ grep -v ^# /etc/locale.gen | grep -v ^$
> en_US.UTF-8 UTF-8
> $ grep -v ^# /etc/default/locale | grep -v ^$
> LANG=en_US.UTF-8
> $ locale
> LANG=en_US.UTF-8
> LC_CTYPE="en_US.UTF-8"
> LC_NUMERIC="en_US.UTF-8"
> LC_TIME="en_US.UTF-8"
> LC_COLLATE=C
> LC_MONETARY="en_US.UTF-8"
> LC_MESSAGES="en_US.UTF-8"
> LC_PAPER="en_US.UTF-8"
> LC_NAME="en_US.UTF-8"
> LC_ADDRESS="en_US.UTF-8"
> LC_TELEPHONE="en_US.UTF-8"
> LC_MEASUREMENT="en_US.UTF-8"
> LC_IDENTIFICATION="en_US.UTF-8"
> LC_ALL=
> $ locale charmap
> UTF-8
> $ localedef --list-archive
> en_US.utf8
> 
> 
> However, nl_langinfo(CODESET) returns ANSI_X3.4-1968:
> 
> 
> $ cat test.c
> #include <stdio.h>
> #include <langinfo.h>
> 
> int main(int argc, char *argv[])
> {
>   printf("%s\n", nl_langinfo(CODESET));
>   return 0;
> }
> $ gcc test.c -o test
> $ ./test
> ANSI_X3.4-1968
> 
> 
> Why would nl_langinfo() be different than everything else and how can I
> fix this?  Note that the manpage specifies that it should return the same
> string as `locale charmap` -- that is obviously not the case here.
> 

This is not a bug. On startup of the main program, the portable "C"
locale is selected as default. If you want to select the locale from the
environment, you should call setlocale(LC_ALL, ""); at the beginning of
the program.

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net


--- End Message ---

Reply to: