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

Java interpreter can't get some character encoding as command line arguments.

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_2.6

      Description

      On Solaris 2.6 with ja_JP.PCK locale,
      Java interpreter can't get Shift-JIS encoding characters correctly as command line arguments.

      Please try these steps.
       1)Login Solaris 2.6 with ja_JP.PCK locale.
       2)Compile following program.
       3)Execute below in command line.
      %java ArgsTest A 65
      %java ArgsTest ‚  12354
      %java ArgsTest l 20154
      %java ArgsTest ‰N 19985

      Only "A" is got correctly.
      Other characters(Shift-JIS) are changed.

      ====== ArgsTest.java =========================================================
      public class ArgsTest {
          public static void main(String args[]) {
      if(args.length == 0){
      System.out.println("no arg");
      return;
      }
      char line[] = new char[args.length - 1];
      for(int i = 1; i < args.length; i++) {
      try {
      line[i-1] = (char)Integer.parseInt(args[i]);
      System.out.println((int)line[i-1]);
      } catch(NumberFormatException e) {
      System.out.println("NFE " + e);
      return;
      }
      }
      String ns = new String(line);
      if(!ns.equals(args[0])) {
      System.out.println("No good:" + args[0] + "!=" + ns);
      return;
      }
      System.out.println("okay:" + args[0] + "=" + ns);
      return;
          }
      }

      =============================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              apalanissunw Anand Palaniswamy (Inactive)
              Reporter:
              eishidasunw Etsuko Ishida (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: