들레아빠
15.07.09
조회 수 3118
추천 수 3
댓글 3

한글을 유니코드로 변경 할 때 16진수 영문 대문자를 소문자로 하나씩 바꾸기 귀찮아서..



<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Korean UniCode Convert</title>
</head>
<body>
<script type="text/javascript">
window.moveTo(0,0)
window.resizeTo(800, 300)
function trans(){
 var str = document.getElementById("hangul").value;

 document.getElementById("unicode").value = replaceAll(escape(str),"%", "\").split("A").join("a").split("B").join("b").split("C").join("c").split("D").join("d").split("E").join("e").split("F").join("f");
}

function detrans(){
 var str = document.getElementById("unicode2").value;
 
 document.getElementById("hangul2").value = unescape(replaceAll(str,"\","%")); 
}
function replaceAll(strTemp, strValue1, strValue2){
 
    while(1){
        if( strTemp.indexOf(strValue1) != -1 )
            strTemp = strTemp.replace(strValue1, strValue2);
        else
            break;
    }
    return strTemp;
}
</script>
<br><br>
한글 -> 유니코드
<input type="text" name="hangul" id="hangul" onkeyDown="JavaScript:if(event.keyCode==13){trans();}">
<input type="button" name="aa" value="변환" onclick="trans()">
결과 : <input type="text" name="unicode" id="unicode" size="50">
<br><br>
유니코드 -> 한글
<input type="text" name="unicode2" id="unicode2" onkeyDown="JavaScript:if(event.keyCode==13){detrans();}">
<input type="button" name="aa" value="변환" onclick="detrans()">
결과 : <input type="text" name="hangul2" id="hangul2" size="50">
</body>
</html>

Extra Form
첨부
unicod.zip  [File Size:834Bytes/Download:9]
unicode.jpg  [File Size:179.1KB/Download:0]
댓글을 남겨야 다운로드가 가능합니다. 감사의 댓글을 달고 오른쪽 확인버튼을 눌러주세요.
다운로드시 일주일에 한개 이상의 게시물 작성이 필요합니다. 지금 자유게시판에 회원님의 하루를 남겨보세요.
추천♡버튼을 잊지 마세요. 추천인과 회원님 모두 포인트가 적립됩니다.
댓글 3
댓글 쓰기 권한이 없습니다.
정렬 목록 검색 쓰기
등록된 글이 없습니다.
1 - 2