¡@

Home 

javascript Programming Glossary: utf8length

Count bytes in textarea using javascript

http://stackoverflow.com/questions/2848462/count-bytes-in-textarea-using-javascript

a naive implementation getUTF8Length function string var utf8length 0 for var n 0 n string.length n var c string.charCodeAt n if.. n 0 n string.length n var c string.charCodeAt n if c 128 utf8length else if c 127 c 2048 utf8length utf8length 2 else utf8length.. n if c 128 utf8length else if c 127 c 2048 utf8length utf8length 2 else utf8length utf8length 3 return utf8length..