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

HTMLEditorKit does not support symbols spread over 2 chars in the java string

XMLWordPrintable

      A DESCRIPTION OF THE PROBLEM :
      Java encodes its strings as UTF-16 characters. This means in most cases a single symbol can fit within 1 char (16 bit). But when the java string is to represent a unicode symbol which is encoded as 32 bit in UTF-16, it will be stored as two consecutive chars in the string.
      HTMLEditorKit treats this as 2 characters instead of combining it into one when using write method.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1.Create HTMLDocument\
      2. Insert this string into its body "𠜎𠜱𠝹𠱓𠱸𠲖𠳏"
      3. Save it using HTMLEditor write method


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Html contains "𠜎𠜱𠝹𠱓𠱸𠲖𠳏"
      ACTUAL -
      Html contains 14 dummy symbols

            pmangal Priyanka Mangal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: