解决思路,把中文转换为两个字节的英文,再计算长度。
function getStrLength(str) { return str.replace(/[\u0391-\uFFE5]/g,"aa").length; }
JS 获取字符串实际长度
原文:http://www.cnblogs.com/wave-gbt/p/js-get-str-length.html