티스토리 뷰

개발/개발 자료

자바 String 인코딩 찾기

시원한물냉 2013. 10. 17. 11:23
String word = s;
System.out.println("utf-8(1) : " + new String(word.getBytes("utf-8"), "euc-kr"));
System.out.println("utf-8(2) : " + new String(word.getBytes("utf-8"), "ksc5601"));
System.out.println("utf-8(3) : " + new String(word.getBytes("utf-8"), "x-windows-949"));
System.out.println("utf-8(4) : " + new String(word.getBytes("utf-8"), "iso-8859-1"));
 
System.out.println("iso-8859-1(1) : " + new String(word.getBytes("iso-8859-1"), "euc-kr"));
System.out.println("iso-8859-1(2) : " + new String(word.getBytes("iso-8859-1"), "ksc5601"));
System.out.println("iso-8859-1(3) : " + new String(word.getBytes("iso-8859-1"), "x-windows-949"));
System.out.println("iso-8859-1(4) : " + new String(word.getBytes("iso-8859-1"), "utf-8"));
 
System.out.println("euc-kr(1) : " + new String(word.getBytes("euc-kr"), "ksc5601"));
System.out.println("euc-kr(2) : " + new String(word.getBytes("euc-kr"), "utf-8"));
System.out.println("euc-kr(3) : " + new String(word.getBytes("euc-kr"), "x-windows-949"));
System.out.println("euc-kr(4) : " + new String(word.getBytes("euc-kr"), "iso-8859-1"));
 
System.out.println("ksc5601(1) : " + new String(word.getBytes("ksc5601"), "euc-kr"));
System.out.println("ksc5601(2) : " + new String(word.getBytes("ksc5601"), "utf-8"));
System.out.println("ksc5601(3) : " + new String(word.getBytes("ksc5601"), "x-windows-949"));
System.out.println("ksc5601(4) : " + new String(word.getBytes("ksc5601"), "iso-8859-1"));
 
System.out.println("x-windows-949(1) : " + new String(word.getBytes("x-windows-949"), "euc-kr"));
System.out.println("x-windows-949(2) : " + new String(word.getBytes("x-windows-949"), "utf-8"));
System.out.println("x-windows-949(3) : " + new String(word.getBytes("x-windows-949"), "ksc5601"));
System.out.println("x-windows-949(4) : " + new String(word.getBytes("x-windows-949"), "iso-8859-1"));


댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함