2011. 3. 26. 15:31
한글 파라메터 전송시 유니코드로 전송될 때 카테고리 없음2011. 3. 26. 15:31
입력: �C0;�C1�C2
출력: #00C0#00C1#00C2
private String convertUnicode(String src){
char[] temp=src.toCharArray();
StringBuffer result=new StringBuffer(temp.length);
for(int i=0;i<temp.length;i++){
if(temp[i]=='&' && temp.length>i+7 && temp[i+1]=='#' && temp[i+7]==';'){
try{
result.append((char)Integer.parseInt(src.substring(i+2, i+7)));
i=i+7;
}catch(NumberFormatException e){
result.append(temp[i]);
}
}
else
result.append(temp[i]);
}
result.trimToSize();
return result.toString();
}
출처 : http://kin.naver.com/qna/detail.nhn?d1id=1&dirId=1040201&docId=108791164&qb=7ZWc6riA7J2EIOycoOuLiOy9lOuTnOuhnA==&enc=utf8§ion=kin&rank=3&search_sort=0&spq=0&pid=gh1yhdoi5T0ssu5wdJwsss--450806&sid=TY0owDMfjU0AABk8JDo