Skip to content

Instantly share code, notes, and snippets.

@ohjongin
Created August 1, 2014 08:46
Show Gist options
  • Save ohjongin/7a942e0305569aa25b9d to your computer and use it in GitHub Desktop.
Save ohjongin/7a942e0305569aa25b9d to your computer and use it in GitHub Desktop.
유니코드 vs. 한글코드로 상호 변환
// from: http://www.senun.com/Left/Programming/Java/Jsp/jsp_syntax_hangul.htm
// 유니코드를 한글코드로 변환
protected String uni2ksc (String Unicodestr) throws UnsupportedEncodingException {
return new String (Unicodestr.getBytes("8859_1"),"KSC5601");
}
// 한글코드를 유니코드로 변환
protected String ksc2uni(String str) throws UnsupportedEncodingException {
return new String( str.getBytes("KSC5601"), "8859_1");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment