From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23987 invoked by alias); 6 Dec 2001 09:06:01 -0000 Mailing-List: contact java-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-prs-owner@gcc.gnu.org Received: (qmail 23946 invoked by uid 71); 6 Dec 2001 09:06:00 -0000 Resent-Date: 6 Dec 2001 09:06:00 -0000 Resent-Message-ID: <20011206090600.23944.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org, java-prs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, michel.chevanne@alcatel.fr Message-Id:<20011206090244.21806.qmail@sources.redhat.com> Date: Sun, 28 Oct 2001 04:46:00 -0000 From: michel.chevanne@alcatel.fr Reply-To: michel.chevanne@alcatel.fr To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:gnatsweb-2.9.2 (1.1.1.1.2.21) Subject: libgcj/5031: LANG=fr_FR incorrectly translated into user.language/user.region X-SW-Source: 2001-q4/txt/msg00032.txt.bz2 List-Id: >Number: 5031 >Category: libgcj >Synopsis: LANG=fr_FR incorrectly translated into user.language/user.region >Confidential: no >Severity: non-critical >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Thu Dec 06 01:06:00 PST 2001 >Closed-Date: >Last-Modified: >Originator: Michel Chevanne >Release: gcc 3.0.2 >Organization: >Environment: Linux 2.2.18-SMP Suse 7.1 distribution >Description: If I do : export LANG=fr_FR then from a java program : "user.language" is "LC" and "user.region", "CT" Sun Java correctly indicate user.langage=fr user.region=FR >How-To-Repeat: see description import java.util.*; public class Test { public static void main(String [] args) { System.err.println(System.getProperty("user.language")); System.err.println(System.getProperty("user.region")); } } Do also : #include #include "stdlib.h" #include "stdio.h" #include int main(char * argv [],int args) { char *locale = setlocale (LC_ALL, ""); printf(locale); } >Fix: The parsing is done in natSystem.cc at line 428, The code does : char *locale = setlocale (LC_ALL, ""); and copy the first two chars to user.language but a small test with a c program indicates that the result of setLocale is : LC_CTYPE=fr_FR;LC_NUMERIC=fr_FR;LC_TIME=fr_FR;LC_COLLATE=C;LC_MONETARY=fr_FR;LC_MESSAGES=fr_FR;LC_PAPER=fr_FR;LC_NAME=fr_FR;LC_ADDRESS=fr_FR;LC_TELEPHONE=fr_FR;LC_MEASUREMENT=fr_FR;LC_IDENTIFICATION=fr_FR so the code parse "LC_CT" instead of "LC_NM". A quick verification on a HP UX 10.20/GCC 2.7.2.2 indicates that the result of setLocale is fr_FR.roman8 fr_FR.roman8 fr_FR.roman8 fr_FR.roman8 fr_FR.roman8 fr_FR.roman8 (with LANG=fr_FR.roman8) So the best way to proceed it probably : to look for the string "=", if present start the parsing after the "=" otherwise, do a before >Release-Note: >Audit-Trail: >Unformatted: