??????ε????????????
????System.out.println(System.getProperty("file.encoding"));
????str??unicode???????????????????????

 

printBytes(str.getBytes("utf-8")); // -28 -72 -83 -26 -106 -121
printBytes(str.getBytes("unicode")); // -2 -1 78 45 101 -121
printBytes(str.getBytes("gb2312")); // -42 -48 -50 -60

???????????iso8859-1?????iso8859-1???????????????63??63
????printBytes(str.getBytes("iso8859-1")); // 63 63
???????bytes??????????????????string

 

byte[] bytes = {-28?? -72?? -83?? -26?? -106?? -121};
System.out.println(getStringFromBytes(bytes??"utf-8"));
byte[] bytes1 = { -2??-1??78?? 45?? 101?? -121};
System.out.println(getStringFromBytes(bytes1??"unicode"));
System.out.println(new String(bytes1));//

????bytes1??unicode??"????"??????????????utf-8????unicode??bytes????utf8????????????string??????
????????????????????????
?????????????utf8???????????????“????”?????????hex???????????????????

????readBytesFromFile("C:/D/charset/utf8.txt");????????????bytes??-17 -69 -65 -28 -72 -83 -26 -106 -121??????-28 -72 -83 -26 -106 -12??"????"??utf-8????bytes??-17 -69 -65 ??utf8????????????????????????bytes??e4=256-28=228??getBytes???????-28????e4???????????????
?????????????gb2312???????????????“????”?????????hex???????????????????

????readBytesFromFile("C:/D/charset/gb2312.txt");????????????bytes??-42 -48 -50 -60??“????”??gb2312????
????D6 = 256-42 =214??D0=256-48=208
??????????????????????????????????????????????????????????????????????InputStreamReader????????
????readStringFromFile("C:/D/charset/utf8.txt"??"utf8");
????readStringFromFile("C:/D/charset/gb2312.txt"??"gb2312");