public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
From: michel.chevanne@alcatel.fr
To: gcc-gnats@gcc.gnu.org
Subject: libgcj/5031: LANG=fr_FR incorrectly translated into user.language/user.region
Date: Sun, 28 Oct 2001 04:46:00 -0000	[thread overview]
Message-ID: <20011206090244.21806.qmail@sources.redhat.com> (raw)


>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:


             reply	other threads:[~2001-12-06  9:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-28  4:46 michel.chevanne [this message]
2002-01-08 13:45 tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20011206090244.21806.qmail@sources.redhat.com \
    --to=michel.chevanne@alcatel.fr \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).