JDK-8151487 : IBM037 Charset - wrong char at 0x15
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio.charsets
  • Affected Version: 8,9
  • Priority: P4
  • Status: Resolved
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2016-03-06
  • Updated: 2017-08-28
  • Resolved: 2016-05-17
Related Reports
Duplicate :  
Description
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.



Comments
there are two "standards/ways" to encode the nl. jdk is following the IBM "default" behavior ...
28-08-2017

Attached test case executed on: JDK 8 - Fail JDK 8u74 - Fail JDK 8u76 - Fail JDK 1.9.0 - Fail
09-03-2016