-
Bug
-
Resolution: Fixed
-
P3
-
1.1.6
-
1.2fcs
-
generic
-
generic
-
Not verified
CharToByteUnicode generates Big endian Unicode on Win32 platform even if its
default seems to be little endian. (Both Notpad and Word97 on WinNT save
Unicode file in little endian order.)
/**
* Convert arrays containing Unicode characters into arrays of bytes, using the
* platform-default byte order.
*
* @version 1.3, 96/11/23
* @author Mark Reinhold
*/
public class CharToByteUnicode extends CharToByteConverter {
static final char BYTE_ORDER_MARK = (char) 0xfeff;
protected boolean marked = false;
static final int UNKNOWN = 0;
static final int BIG = 1;
static final int LITTLE = 2;
protected int byteOrder = UNKNOWN;
public CharToByteUnicode() {
String enc = System.getProperty("unicode.encoding", "UnicodeBig");
if (enc.equals("UnicodeBig"))
See above comment that it says "platform-default byte order".
However current implementation always generates Big endian order because
the system property "unicode.encoding" is not set anywhere.
If I trust what the comment says, then "unicode.encoding" should be set properly. Otherwise the spec should clearly mention that Java Unicode is
UnicodeBig and unnecessary code should be removed.
default seems to be little endian. (Both Notpad and Word97 on WinNT save
Unicode file in little endian order.)
/**
* Convert arrays containing Unicode characters into arrays of bytes, using the
* platform-default byte order.
*
* @version 1.3, 96/11/23
* @author Mark Reinhold
*/
public class CharToByteUnicode extends CharToByteConverter {
static final char BYTE_ORDER_MARK = (char) 0xfeff;
protected boolean marked = false;
static final int UNKNOWN = 0;
static final int BIG = 1;
static final int LITTLE = 2;
protected int byteOrder = UNKNOWN;
public CharToByteUnicode() {
String enc = System.getProperty("unicode.encoding", "UnicodeBig");
if (enc.equals("UnicodeBig"))
See above comment that it says "platform-default byte order".
However current implementation always generates Big endian order because
the system property "unicode.encoding" is not set anywhere.
If I trust what the comment says, then "unicode.encoding" should be set properly. Otherwise the spec should clearly mention that Java Unicode is
UnicodeBig and unnecessary code should be removed.