FineReport中cjk編碼轉換

js代碼

function cjkEncode(text) {       
    if (text == null) {       
        return "";       
    }       
    var newText = "";       
    for (var i = 0; i < text.length; i++) {       
        var code = text.charCodeAt (i);        
        if (code >= 128 || code == 91 || code == 93) {//91 is "[", 93 is "]".       
            newText += "[" + code.toString(16) + "]";       
        } else {       
            newText += text.charAt(i);       
        }       
    }       
    return newText;       
}   

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章