javascript에서 text의 byte length 구하기

// get byte length
function bytelen(v){
	var blen = 0;
	for(i=0; i<v.length; i++){
		var c = v.charAt(i);
		//escape code의 길이가 4보다 크면 한글
		blen += (escape(c).length > 4) ? 2 : 1;
	}
	return blen;
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2008-12-18 11:07:57
Processing time 0.0069 sec