Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Sep 2002 23:02:19 +0300
From:      Alexey Zelkin <phantom@freebsd.org>
To:        ache@freebsd.org
Cc:        i18n@freebsd.org
Subject:   setlocale() fallback behaviour
Message-ID:  <20020920230219.A88895@ark.cris.net>

next in thread | raw e-mail | index | archive | help
Andrey,

Today I have found an issue with current setlocale() code.
If LANG is set to incorrect value, LC_ALL is unset and some of
LC_* variables set to correct value call to setlocale(LC_ALL, "")
will fail because of incorrect LANG value.

I.e. having

LANG=invalid
LC_TIME=ru_RU.KOI8-R

with call setlocale(LC_ALL, "") we'll get completely "C" defaulting
locale.

Looking for comment in rev 1.30 of setlocale.c (that quotes POSIX
standard) user may expect that LC_TIME is initialized in this case,
but it is not.

: The values of locale categories shall be determined by a precedence
: order; the first condition met below determines the value:
:
: 1. If the LC_ALL environment variable is defined and is not null,
:    the value of LC_ALL shall be used.
: 2. If the LC_* environment variable (LC_COLLATE, LC_CTYPE, LC_MESSAGES,
:    LC_MONETARY, LC_NUMERIC, LC_TIME) is defined and is not null, the
:    value of the environment variable shall be used to initialize the
:    category that corresponds to the environment variable.
: 3. If the LANG environment variable is defined and is not null, the
:    value of the LANG environment variable shall be used.
: 4. If the LANG environment variable is not set or is set to the empty
:    string, the implementation-defined default locale shall be used.

I think this one need to be corrected.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-i18n" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020920230219.A88895>