<i18n dev> Fwd: Some differences on Window UDC area
Charles Lee
littlee at linux.vnet.ibm.com
Sun Mar 27 19:17:48 PDT 2011
-------- Original Message --------
Subject: Some differences on Window UDC area
Date: Thu, 24 Mar 2011 09:34:20 +0800
From: Charles Lee <littlee at linux.vnet.ibm.com>
To: i18n-dev at openjdk.java.net, littlee at 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("");
}
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/i18n-dev/attachments/20110328/34e92434/attachment.html
More information about the i18n-dev
mailing list