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

CharToByteISO8859_1 should increment charOff if a high surrogate is the last

XMLWordPrintable

      CharToByteISO8859_1.convert() should increment charOff if a high surrogate is the last character in the input array before doing the break. So the next convert() can process the remaining characters correctly.

      I attached a test. In this test case, the input array is {'a', 'b', 'c', 'd', 'e', '\uD800', '\uDC00', 'f', 'g', 'h'}. First it converts from 0 to 6 (the location of the high surrogate), then converts from nextCharIndex() (the location of the low surrogate) to the end. The second conversion throws MalformedInputException with the message:

      "Previous converted string ends with <High Half Zone Code> of UTF16 , but this string is not begin with <Low Half Zone>"

      The exception shouldn't happen, since it's a legal UTF16 sequence. Increment charOff before the break will fix the problem.

      jiangli.zhou@eng 2001-05-22

            Unassigned Unassigned
            jiangli Jiangli Zhou
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: