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

String#getBytes("JIS") returns incorrect result

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.1
    • core-libs
    • None
    • x86
    • windows_nt



      Name: mc57594 Date: 03/06/97


      String#getBytes("JIS") and OutputStreamWriter object created by
          OutputStreamWriter w = new OutputStreamWriter(outputstream, "JIS");
      encode strings incorrectly.
      They always append shift-in sequence to encoded byte sequence, even if it is not necessary.
      For example,
          String s = new String("abc");
          byte b[];
          try {
              b = s.getBytes("JIS");
              ..........
          }
          catch (Exception e) { ...... }
      In this example, expected result is
          b[] = { 'a', 'b', 'c' }
      but result I gotten is
          b[] = { 'a', 'b', 'c', '\x1b', '\x28', '\42' }
                                 --------------------- shift-in
      This is wrong clealy.
      Is this bug ?
      Thank you.


      company - Kanazawa Research Institute , email - ###@###.###
      ======================================================================

            nishimur Naoyuki Ishimura (Inactive)
            mchamnessunw Mark Chamness (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: