JDK-4351203 : sun.awt.motif.CharToByteX11CNS11643P* converters not up to spec
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio.charsets
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: generic
  • CPU: generic
  • Submitted: 2000-07-07
  • Updated: 2006-02-01
  • Resolved: 2006-02-01
Related Reports
Relates :  
Description
The sun.awt.motif.CharToByteX11CNS11643P* converters do not handle subsitution correctly. According to the specification in CharToByteConverter, substitution bytes should only be inserted if substitution is enabled; otherwise an exception should be thrown. Also, it's not clear why null bytes are inserted if fewer than two substitution bytes are defined.

Comments
EVALUATION In addition to the evaluation above, The sun.awt.motif.CharToByteXYZ converters have been re-implemented in 6.0 by using the java.nio.charset APIs which provides the standard way to handle replacement/substitution. Closed as "not reproducible".
01-02-2006

EVALUATION By examining converters under awt/motif, I thought all converters for X11 should pad 2 byte for 1 unicode. If this is not true, correct number of byte should be inserted depend on the substitution bytes. karl.hong@eng 2000-05-31 =========================================================================== This appears to be fixed already in 1.4 as part of fix to 4393099 : Need CharToByte and ByteToChar converters for x-compound-text encoding The fix provided also includes broadened support for CHS-11643 planes 1-3 and the correct substitution algorithm is provided when subMode is defined: while (inI < inEnd) { if (outI > outTop) { charOff = inI; byteOff = outI; throw new ConversionBufferFullException(); } if (canConvert(input[inI])) { int cns = unicodeToEUC(input[inI++]); output[outI++] = (byte)((cns >> 8) & 0x7f); output[outI++] = (byte)(cns & 0x7f); + } else if (subMode) { + inI++; + output[outI++] = (subBytes.length > 0) ? subBytes[0] : 0; + output[outI++] = (subBytes.length > 1) ? subBytes[1] : 0; + } else { + charOff = inI; + byteOff = outI; + throw new UnknownCharacterException(); + } } ian.little@Ireland 2001-07-31
31-07-2001