프로그래머의 삶 Programmer's Life/Java!!

캐릭터셋 식별

Oliver's World 2010. 5. 6. 14:20
728x90

public static void charSet(String str_kr)
   throws UnsupportedENCODINGException {
  String charset[] = { "euc-kr", "ksc5601", "iso-8859-1", "8859_1",
    "ascii", "UTF-8", "MS949" };

  for (int i = 0; i < charset.length; i++) {
   for (int j = 0; j < charset.length; j++) {
    if (i == j)
     continue;

    System.out.println("####################         " + charset[i]
      + " : " + charset[j] + " :"
      + new String(str_kr.getBytes(charset[i]), charset[j]));
   }
  }
 }

728x90