字符編碼相關(guān)
String str = "中國(guó)";?
byte[] bt = str.getBytes("utf-8");?
for(byte b:bt){
?System.out.print(Integer.toHexString(b&0xff) + " ");?
}?
輸出結(jié)果為: e4 b8 ad e5 9b bd?
?為什么 dos.writeUTF("中國(guó)"); 結(jié)果是 00 ?06 ?e4 ?b8 ?ad ?e5 ?9b ?bd ?? 前邊的 00 06 是什么?
2016-09-04
編碼方式不一樣。
2016-08-18
這是他老外自己的代碼實(shí)現(xiàn)的,你可查看源代碼
Dug調(diào)試如下,希望你能理解:
2016-08-18
不知道