This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

libgcj/5031: LANG=fr_FR incorrectly translated into user.language/user.region



>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 <unistd.h>
#include "stdlib.h"
#include "stdio.h"
#include <locale.h>


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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]