JAKARTAPROJECT
JAKARTA TIPJSP TIPJSP Áú¹®&´äº¯DATABASE TIPJAVASCRIPT TIPWEBHACKING TIP±âŸ TIP
ÀÚ¹Ù½ºÅ©¸³Æ® ÆÁ
ÀÚ¹Ù½ºÅ©¸³Æ® ÆÁ
ÀÚ¹Ù½ºÅ©¸³Æ® ¹× CSS ÆÁ °Ô½ÃÆÇÀÔ´Ï´Ù
Javascript UTF-8
GoodBug http://www.jakartaproject.com
À̹ÌÁö ½½¶óÀÌ´õ º¸±â

Javascript UTF-8

Overview

The encoding known today as UTF-8 was invented by Ken Thompson. UTF-8 is a variable-length character encoding for Unicode. It can represent any character in the Unicode standard, yet is backwards compatible with ASCII.

Use this Javascript to encode decode UTF-8 data. Don't forget to set the page encoding to UTF-8 (Content-Type meta tag).

 

Source code for webtoolkit.utf8.js

 
/**
*
* UTF-8 data encode / decode
* http://www.webtoolkit.info/
*
**/

var Utf8 = {

    // public method for url encoding
    encode : function (string) {
        string = string.replace(/\r\n/g,"\n");
        var utftext = "";

        for (var n = 0; n < string.length; n++) {

            var c = string.charCodeAt(n);

            if (c < 128) {
                utftext += String.fromCharCode(c);
            }
            else if((c > 127) && (c < 2048)) {
                utftext += String.fromCharCode((c >> 6) | 192);
                utftext += String.fromCharCode((c & 63) | 128);
            }
            else {
                utftext += String.fromCharCode((c >> 12) | 224);
                utftext += String.fromCharCode(((c >> 6) & 63) | 128);
                utftext += String.fromCharCode((c & 63) | 128);
            }

        }

        return utftext;
    },

    // public method for url decoding
    decode : function (utftext) {
        var string = "";
        var i = 0;
        var c = c1 = c2 = 0;

        while ( i < utftext.length ) {

            c = utftext.charCodeAt(i);

            if (c < 128) {
                string += String.fromCharCode(c);
                i++;
            }
            else if((c > 191) && (c < 224)) {
                c2 = utftext.charCodeAt(i+1);
                string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
                i += 2;
            }
            else {
                c2 = utftext.charCodeAt(i+1);
                c3 = utftext.charCodeAt(i+2);
                string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
                i += 3;
            }

        }

        return string;
    }

}
 
 
2008-01-16 00:05:39
220.70.88.***

 

ÁÁÀº»ý°¢ ^^

0Á¡ (0¸í)
µ¡±Û 0°³ | ÅÂ±× 1°³ | °ü·Ã±Ûº¸±â
ű×ÀÔ·Â
½±Ç¥(,)±¸ºÐÀ¸·Î Çѹø¿¡ ¿©·¯ ű׸¦ ÀÔ·ÂÇÒ¼ö ÀÖ½À´Ï´Ù
UTF8 (2)
À̸§ ºñ¹Ð¹øÈ£
ÀÚ¹Ù½ºÅ©¸³Æ® ÆÁ
ÀÚ¹Ù½ºÅ©¸³Æ® ¹× CSS ÆÁ °Ô½ÃÆÇÀÔ´Ï´Ù
! ¹øÈ£ Á¦¸ñ ±Û¾´ÀÌ ÀÏÀÚ Á¶È¸
220 img À̹ÌÁö ºÎµå·´°Ô ÁÙÀ̱â 1 GoodBug 2009-12-18 8,193
219 rss xml ÆĽÌÇÏ´Â ¸ðµâ ÀÔ´Ï´Ù. 1 °í°í½Ì 2009-11-27 7,641
218 Æ®¸® ÀÔ´Ï´Ù . 1 °í°í½Ì 2009-11-27 5,873
217 ¿¡·¯Ã³¸® 1 kaiser 2009-05-11 6,088
216 À¥ÆäÀÌÁö º¹»ç ¹æÁö ÇØÁö ÇÏ´Â ¹ý kaiser 2009-05-03 11,673
215 javascript ÇÑ±Û Â¥¸£±â 1 1 kaiser 2008-08-14 7,985
214 rolling ·Ñ¸µ ½ºÅ©¸³Æ® 1 2 GoodBug 2008-07-11 10,128
213 alert ¸Þ½ÃÁö¸¦ print ó·³ »ç¿ëÇϱâ 2 °í°í½Ì 2008-06-10 8,675
212 onload onload Æã¼ÇÀÌ Á¤ÀǵǾî ÀÖ´Â »óȲ¿¡¼­ onload¿¡ Ãß°¡Çϱâ 1 GoodBug 2008-04-11 8,440
211 javascript ÀÚ¹Ù½ºÅ©¸³Æ® °³¹ß°¡À̵å 4 1 kaiser 2008-04-09 8,898
210 escape HTML escpae code 1 GoodBug 2008-04-02 6,499
209 optgroup SELECT ¸ñ·Ï ±×·ìº°·Î ¹­±â 1 1 GoodBug 2008-03-06 8,215
208 µ¿Àû Å×À̺í Å×ÀÌºí¿¡ µ¿Àû TR »ðÀÔ ¹× »èÁ¦ IE, FF °ø¿ë 1 GoodBug 2008-01-18 11,745
207 drag Javascript drag and drop 1 1 GoodBug 2008-01-16 8,171
206 sort Sortable HTML table 2 GoodBug 2008-01-16 7,402
205 scrollable table Scrollable HTML table 1 GoodBug 2008-01-16 7,087
204 CSS CSS centered layout 1 1 GoodBug 2008-01-16 6,685
utf8 Javascript UTF-8 1 GoodBug 2008-01-16 7,914
202 encode Javascript url decode, encode 2 GoodBug 2008-01-16 8,159
201 ¾Ïȣȭ Javascript MD5 2 GoodBug 2008-01-15 7,364
copyright 2005-2024 by Unicorn