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

Cannot invoke class from command line with args containing non-ASCII characters

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 6, 6u10, 6u24
    • tools
    • x86
    • windows_xp, windows_7

      FULL PRODUCT VERSION :
      java version "1.6.0_02"
      Java(TM) SE Runtime Environment (build 1.6.0_02-b06)
      Java HotSpot(TM) Client VM (build 1.6.0_02-b06, mixed mode, sharing)


      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      When invoking a class from the command line with arguments that contain characters higher than 0xFF, the arguments in the String array passed to the class' main method do not match the arguments specified on the command line.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the test program, and specify an argument with a character higher than 0xFF. (see attachment for sample)

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Expect the test program to print the same output twice -- once for the hard-coded string and once for the same characters specified on the command line.
      ACTUAL -
      The first set of output (for the hard-coded string is correct), but the second set is not:
      A?
      0x41
      0x3c0

      Ap
      0x41
      0x70

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class Test
      {
      public static void main (String[] args)
      {
      String testStr1 = "A\u03c0";
      System.out.println(testStr1);
      printHexVals(testStr1);

      if (args.length > 0) {
      String testStr2 = args[0];
      System.out.println();
      System.out.println(testStr2);
      printHexVals(testStr2);
      }
      }
      private static void printHexVals(String str) {
      for (int i=0; i<str.codePointCount(0, str.length()); i++) {
      System.out.println("0x" + Integer.toHexString(str.codePointAt(i)));
      }
      }
      }
      ---------- END SOURCE ----------

            ksrini Kumar Srinivasan
            ryeung Roger Yeung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: