This is the mail archive of the
mailing list for the glibc project.
Re: The behavor of printing out libc message catalog without calling setlocale()
- To: GOTO Masanori <gotom at debian dot or dot jp>
- Subject: Re: The behavor of printing out libc message catalog without calling setlocale()
- From: Ulrich Drepper <drepper at redhat dot com>
- Date: 07 Nov 2000 10:46:33 -0800
- Cc: libc-alpha at sourceware dot cygnus dot com
- References: <firstname.lastname@example.org><200011071838.DAA04686@smtp5.dti.ne.jp>
- Reply-To: drepper at cygnus dot com (Ulrich Drepper)
GOTO Masanori <email@example.com> writes:
> What standard is it described?
No standard describes gettext. I've written gettext with some friends
> If calling setlocale() is needed anytime when we set locale-related
> env variables, we must write setlocale() into hello.c ?!
> # Why don't you have setlocale(LC_ALL,"") in crt0.o? :-)
Because this would violate existing standards.
> If we set the locale-related variables but a program does not
> call setlocale(), it should work as same as LC_ALL=C. Unix98 said that:
> For C-language programs, the POSIX locale is the default locale
> when the setlocale() function is not called.
Yes. That's what we do.
> I set only LANGUAGE=ja_JP.eucJP, the sample 1 and 2 program
> which is written in my previous mail fail to print out Japanese
> messages everytime (print out not "Success" or Japanese libc's
> message catalog but "????").
That is because you haven't set the LC_CTYPE category and therefore
the program does not know why character set you use. It uses the C
locale character set which is ASCII.
Basically, setlocale() must always be called.
> A program which does not call setlocale() should not print out
> any libc's translated message.
Unless you use LANGUAGE.
> Current glibc write out translated messages whenever we do not
> call setlocale(). It is not appropriate.
I don't agree. This is the behavior we implemented a long time ago
(at a time when the glibc team consisted of two people). If you don't
want to have translations in this case don't use LANGUAGE. Use LC_ALL
---------------. ,-. 1325 Chesapeake Terrace
Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
Red Hat `--' drepper at redhat.com `------------------------