JDK-5033780 : LANG should have higher precedence than LC_CTYPE for locale
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86
  • Submitted: 2004-04-19
  • Updated: 2010-12-20
  • Resolved: 2010-12-20
Related Reports
Duplicate :  
Description

Name: jl125535			Date: 04/19/2004


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) 
======================================================================

Comments
EVALUATION This has been fixed in JDK7 along with 4700857.
2010-12-20