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

UTF-16* charsets broken

XMLWordPrintable

    • beta
    • generic, x86, sparc
    • generic, solaris_7, windows_nt, windows_2000
    • Verified

      Date: Wed, 10 Jan 2001 17:15:00 -0800 (PST)
      From: David Mendenhall <###@###.###>

      Starting in merlin build 46, text data transfer is completely broken on
      Windows. I suspect the bug is caused by the new java.nio packages, but I
      have not finished my evaluation.

      In the course of testing, I wrote the following program:

      public class ByteOrderTest {
          public static void main(String[] args) throws Exception {
      byte[] bytes = { 102, 0, 111, 0, 111, 0 };

      System.out.println("utf-16le: " + new String(bytes, "utf-16le"));
      System.out.println("utf-16be: " + new String(bytes, "utf-16be"));
          }
      }

      On b45, I saw the output I expected:

      utf-16le: foo
      utf-16be: ???

      On b46, I saw:

      Exception in thread "main" java.nio.BufferOverflowException
              at java.nio.Buffer.nextPutIndex(Buffer.java:367)
              at java.nio.HeapCharBuffer.put(HeapCharBuffer.java:69)
              at java.nio.CharBuffer.put(CharBuffer.java:766)
              at java.nio.CharBuffer.put(CharBuffer.java:790)
              at java.nio.CharsetDecoder.decode(CharsetDecoder.java:292)
              at java.lang.StringCoding$CharsetSD.decode(StringCoding.java:159)
              at java.lang.StringCoding.decode(StringCoding.java:189)
              at java.lang.String.<init>(String.java:326)
              at java.lang.String.<init>(String.java:347)
              at ByteOrderTest.main(ByteOrderTest.java:5)

      And on the newly promoted Solaris b47 (haven't tested Windows):

      utf-16le: ?
      utf-16be: ?

      al.smith@eng 2001-01-23
      Regression test java/lang/String/Encodings.java Failing in Merlin build 48.

      al.smith@eng 2001-04-26
      Verified in build 61

            ilittlesunw Ian Little (Inactive)
            mr Mark Reinhold
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: