Error in CRM 2015 when importing v2.2

Jul 1, 2016 at 5:05 AM
Hi,

I have tried to update my toolkit (v0.2) to v2.2, but there was an error in the code.
Especially this function: it includes a word "CRMEntity" that prevents me to save the script in CRM. This is very strange error. Please advise why this happens.

var innerSurrogateAmpersandWorkaround = function (s) {
    var buffer = '';
    var c0;
    for (var cnt = 0, slength = s.length; cnt < slength; cnt++) {
        c0 = s.charCodeAt(cnt);
        if (c0 >= 55296 && c0 <= 57343)
            if (cnt + 1 < s.length) {
                var c1 = s.charCodeAt(cnt + 1);
                if (c1 >= 56320 && c1 <= 57343) {
                    buffer += "CRMEntityReferenceOpen" + ((c0 - 55296) * 1024 + (c1 & 1023) + 65536).toString(16) + "CRMEntityReferenceClose"; cnt++;
                }
                else
                    buffer += String.fromCharCode(c0);
            }
            else buffer += String.fromCharCode(c0);
        else buffer += String.fromCharCode(c0);
    }
    s = buffer;
    buffer = "";
    for (cnt = 0, slength = s.length; cnt < slength; cnt++) {
        c0 = s.charCodeAt(cnt);
        if (c0 >= 55296 && c0 <= 57343)
            buffer += String.fromCharCode(65533);
        else buffer += String.fromCharCode(c0);
    }
    s = buffer;
    s = htmlEncode(s);
    s = s.replace(/CRMEntityReferenceOpen/g, "&#x");
    s = s.replace(/CRMEntityReferenceClose/g, ";");
    return s;
};


Regards,