2007/07/04 15:56

문자열을 유니코드로 escape 하는 javascript

만약에 '사랑해' 라는 문자열을 입력하면 '%uC0AC%uB791%uD574' 라는 유니코드로 escape해주는 자바스크립트이다 ^ ^




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Escape / Unescape</title>

    <script type="text/javascript">
    <!--//
    function enCode()
    {
        var temp = escape(document.forms[0].inV.value);

        document.forms[0].outV.value = temp;
    }

    function deCode()
    {
        var temp = unescape(document.forms[0].inV.value);

        document.forms[0].outV.value = temp;
    }
    //-->
    </script>

</head>
<body>
    <form name="fo" action="">
    <input type="text" name="inV" /><br />
    <input type="button" value="인코딩" onclick="enCode()" />
    <input type="button" value="디코딩" onclick="deCode()" /><br />
    <input type="text" value="" name="outV" />
    </form>
</body>
</html>

크리에이티브 커먼즈 라이선스
Creative Commons License
올블로그추천버튼 블코추천버튼 블로그뉴스추천버튼 믹시추천버튼 한RSS추가버튼 구글리더기추천버튼


이 포스팅이 도움이 되었다면 구글에서 관련 정보를 찾아 보세요 ^^


Trackback 1 Comment 0

Trackback : http://i-ruru.com/trackback/92 관련글 쓰기

  1. Subject JIXmall :: javascript encode

    Tracked from JIXmall.com 2009/11/23 20:38 delete

    JIXmall :: javascript encode에 대한 정보입니다.