Java
[Java] getBytes 테스트
Sort
2013. 2. 27. 13:28
*.byte 테스트
String s = "aa테스트하하";
byte[] bytes1 = s.getBytes("utf-8"); //한글 3바이트로 인식
out.println(bytes1.length + " : ");
//17
byte[] bytes2 = s.getBytes("euc-kr"); //한글 2바이트로 인식
out.println(bytes2.length + " : ");
//12
out.println( new String(s.getBytes("EUC_KR"),"8859_1").length() + " : ");
//12