Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4943647

Error in character set when $LANG is not defined

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 1.4.2
    • core-libs

      Name: rl43681 Date: 10/24/2003


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


      FULL OS VERSION :
      Linux xldb06 2.4.7-10smp #1 SMP Thu Sep 6 17:09:31 EDT 2001 i686 unknown


      A DESCRIPTION OF THE PROBLEM :
      When the $LANG variable is not defined, special characters are replaced by '?'

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Clean the LANG variable.
      Write a String using any special character to a file or print it to the stdout.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The String.
      ACTUAL -
      Every special character is replaced by ?.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      Clean the LANG environment variable, write this simple program and run it:

      /**
       * @author dcgomes
       *
       * To change the template for this generated type comment go to
       * Window>Preferences>Java>Code Generation>Code and Comments
       */
      public class LangVariableTest {

      public static void main(String[] args) {
      System.out.println("�����");

      }
      }

      In this case everything is OK:
      [dcgomes@xldb06 DAN2]$ export LANG=en_US
      [dcgomes@xldb06 DAN2]$ echo $LANG
      en_US
      [dcgomes@xldb06 DAN2]$ java tester/LangVariableTest
      �����

      But when we clean LANG:

      [dcgomes@xldb06 DAN2]$ export LANG=
      [dcgomes@xldb06 DAN2]$ echo $LANG

      [dcgomes@xldb06 DAN2]$ java tester/LangVariableTest
      ?????

      I didn't find any jdk documentation that imposes that the LANG variable must be set.




      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Always set the LANG variable.
      (Incident Review ID: 217559)
      ======================================================================
      ###@###.### 2003-10-29

            martin Martin Buchholz
            rlewis Roger Lewis (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: