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

IBM037 Charset - wrong char at 0x15

XMLWordPrintable

      FULL PRODUCT VERSION :
      from 1.6 to 1.8.0_65-b17

      ADDITIONAL OS VERSION INFORMATION :
      Mac OSX 10.11.3

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      standard

      A DESCRIPTION OF THE PROBLEM :
      In the position 0x15 there is \n instead \u0085.

      in the 1.6 there si a second wrong in the second table in the position 0x0A there is \u0015 instead of \u0025

      u can see the right character in https://en.wikipedia.org/wiki/EBCDIC_037

       

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      no need

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      it was explained in description
      ACTUAL -
      it was explained in description

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public static void main(String[] args) {
        IBM037 cset = new IBM037();

        byte b[] = {(byte)0x15, 0x25}; // 0x15 = 0x85, 0x25 = 0x0A
        ByteBuffer bb = ByteBuffer.wrap(b);

        CharBuffer s = cset.decode(bb);
        assert (s.charAt(0) == 0x85) : "Wrong decode for 0x15";
        assert (s.charAt(1) == 0x0A) : "Wrong decode for 0x25"; // no error

        ByteBuffer out = cset.encode(s);
        assert (out.get(0) == 0x15) : "Wrong encode for 0x15"; // no error
        assert (out.get(1) == 0x25) : "Wrong encode for 0x25";

        System.out.println("Equal: " + Arrays.equals(b, out.array()));
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      I make my charset identically to IBM037 but with the 2 value replace in 1.6 jdk.


            sherman Xueming Shen
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: