From owner-freebsd-i18n Fri Sep 20 13: 2:40 2002 Delivered-To: freebsd-i18n@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3B12337B401; Fri, 20 Sep 2002 13:02:39 -0700 (PDT) Received: from columbus.cris.net (columbus.cris.net [212.110.128.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id F105F43E3B; Fri, 20 Sep 2002 13:02:28 -0700 (PDT) (envelope-from phantom@ark.cris.net) Received: from ark.cris.net (root@ark.cris.net [212.110.128.68]) by columbus.cris.net (8.9.3/8.9.3) with ESMTP id XAA99129; Fri, 20 Sep 2002 23:02:17 +0300 (EEST) Received: (from phantom@localhost) by ark.cris.net (8.11.1/8.11.1) id g8KK2Jw89738; Fri, 20 Sep 2002 23:02:19 +0300 (EEST) Date: Fri, 20 Sep 2002 23:02:19 +0300 From: Alexey Zelkin To: ache@freebsd.org Cc: i18n@freebsd.org Subject: setlocale() fallback behaviour Message-ID: <20020920230219.A88895@ark.cris.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i X-Operating-System: FreeBSD 3.5-STABLE i386 Sender: owner-freebsd-i18n@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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