This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: nl_langinfo question
- From: Marko Myllynen <myllynen at redhat dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Cc: Michael Haardt <michael at moria dot de>, "mtk.manpages" <mtk dot manpages at gmail dot com>
- Date: Fri, 23 May 2014 12:25:29 +0300
- Subject: Re: nl_langinfo question
- Authentication-results: sourceware.org; auth=none
- References: <537E1090 dot 9070905 at redhat dot com>
- Reply-to: myllynen at redhat dot com
Hi,
On 2014-05-22 17:58, Marko Myllynen wrote:
>
> localhost:~/test> cat test.c
> #include <langinfo.h>
> #include <locale.h>
> #include <stdio.h>
> #include <stdlib.h>
>
> int
> main(int argc, char *argv[])
> {
> setlocale(LC_CTYPE, "");
> printf("%s\n", nl_langinfo(CODESET));
> printf("%s\n", nl_langinfo(DAY_1));
> printf("%s\n", nl_langinfo(RADIXCHAR));
> printf("%s\n", nl_langinfo(NOEXPR));
> exit(EXIT_SUCCESS);
> }
> localhost:~/test> gcc -Wall test.c
> localhost:~/test> LC_ALL=fi_FI.UTF-8 ./a.out
> UTF-8
> Sunday
> .
> ^[nN]
> localhost:~/test>
I see now that my expanded code calls setlocale(LC_CTYPE, "") which
covers only CODESET, not the other elements.
I'll send a patch to man pages to make the included example illustrate
using different categories as well.
Thanks,
--
Marko Myllynen