-------- Original Message --------
Subject: Some differences on Window UDC area
Date: Thu, 24 Mar 2011 09:34:20 +0800
From: Charles Lee <litt...@linux.vnet.ibm.com>
To: i18n-dev@openjdk.java.net, litt...@linux.vnet.ibm.com
Hi guys,
Given the test case below, some UDC are printed out. With some native test case
on windows, the result is expected to be:
\ue585\ue586\ue592 -> \xa2\xa0\xa3\x40\xa3\x4c
But got:
\ue585\ue586\ue592 -> \xa2\xa0\xa2\xab\xa3\x40
Are there any specs to clearify these differences? Are the differences expected?
import java.nio.*;
import java.nio.charset.*;
class zhPUATest {
public static void main(String[] args)throws Exception {
for(String cname :new String[]{"MS936"}) {
Charset charset = Charset.forName(cname);
System.out.println("charset:"+charset.name());
CharsetEncoder ce = charset.newEncoder();
char[] chars =new char[]{0xE585, 0xE586, 0xE592};
CharBuffer cb = CharBuffer.wrap(chars);
ByteBuffer bb = ce.encode(cb);
for(char c : chars) {
System.out.printf("\\u%04x",(int)c);
}
System.out.print(" -> ");
for(byte b : bb.array())if (b != 0x0) {
System.out.printf("\\x%02x",(int)b& 0xFF);
}
System.out.println("");
}
}
}