Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 5033780
Votes 1
Synopsis LANG should have higher precedence than LC_CTYPE for locale
Category java:classes_util_i18n
Reported Against 1.4
Release Fixed
State 3-Accepted, bug
Priority: 4-Low
Related Bugs
Submit Date 19-APR-2004
Description




FULL PRODUCT VERSION :
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b32c)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b32c, mixed mode)

This problem is reproducible on both 1.4.x and 1.5 beta.

ADDITIONAL OS VERSION INFORMATION :
Linux struggle.javabsp 2.6.3-ck1 #7 Mon Mar 22 00:34:34 PST 2004 i686 GNU/Linux

EXTRA RELEVANT SYSTEM CONFIGURATION :
LC_CTYPE=zh_TW.Big5
LANG=en_US

A DESCRIPTION OF THE PROBLEM :
When both LANG and LC_CTYPE are set, applications would use LC_CTYPE to decide the locale. For example, if LC_CTYPE is set to zh_TW.Big5, swing would display dialogs in Traditional Chinese, even though LANG is set to en_US. This is not what any linux applications do, which use LC_CTYPE only as a hint on charset conversion. See `man locale' for more details.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Set LANG to en_US, and LC_CTYPE to anything other than an English encoding.
Run an application that has been localized to the encoding specified by LC_CTYPE, for example, any built-in swing dialogs support zh_TW.Big5 at least partially (you may need to configure java font setting to have the characters display correctly, but that's a whole new problem).

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Everything should still be displayed in English.
ACTUAL -
Swing dialogs uses Traditional Chinese

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
SwingSet2's dialog demo can demonstrate this problem.
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Unset LC_CTYPE everytime before invoking java.
(Incident Review ID: 254811) 
======================================================================
Work Around
N/A
Evaluation
N/A
Comments
  
  Include a link with my name & email   

Submitted On 09-JUL-2007
The locale man page as of glibc-2.4 says that LC_ALL has highest precedence, LC_CTYPE comes next, and LANG is last. The first one that is set is used as the setting for LC_CTYPE (during setlocale()) and if it is not understood, it is ignored.

Your environment simply needs to be changed. Java 1.5 is acting correctly on my system.


Submitted On 22-MAR-2008
j-kidd
I can't believe this bug is still open after 4 years.

If you happen to use Linux in a multilingual environment, you should know for sure that Java is definitely behaving incorrectly.


Submitted On 07-APR-2009
This is definately a bug. Java even ignores the setting of LC_MESSAGES and displays everything in the locale indicated by LC_CTYPE.



PLEASE NOTE: JDK6 is formerly known as Project Mustang