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

String#getBytes("JIS") returns incorrect result

    XMLWordPrintable

Details

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

    Description



      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 - ###@###.###
      ======================================================================

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: