tinymce.full.js
function (text, attr) {
        return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function (chr) {
          // Multi byte sequence convert it to a single entity
          if (chr.length > 1) {
            return '&#' + (((chr.charCodeAt(0) - 0xD800) * 0x400) + (chr.charCodeAt(1) - 0xDC00) + 0x10000) + ';';
          }

          return baseEntities[chr] || '&#' + chr.charCodeAt(0) + ';';
        });
      }
function (text, attr) {
        return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function (chr) {
          // Multi byte sequence convert it to a single entity
          if (chr.length > 1) {
            return '&#' + (((chr.charCodeAt(0) - 0xD800) * 0x400) + (chr.charCodeAt(1) - 0xDC00) + 0x10000) + ';';
          }

          return baseEntities[chr] || '&#' + chr.charCodeAt(0) + ';';
        });
      }
function ( text , attr ) { return text . replace ( attr ? attrsCharsRegExp : textCharsRegExp , function ( chr ) { // Multi byte sequence convert it to a single entity if ( chr . length > 1 ) { return '&#' + ( ( ( chr . charCodeAt ( 0 ) - 0xD800 ) * 0x400 ) + ( chr . charCodeAt ( 1 ) - 0xDC00 ) + 0x10000 ) + ';' ; } return baseEntities [ chr ] || '&#' + chr . charCodeAt ( 0 ) + ';' ; } ) ; }
Encodes the specified string using numeric entities. The core entities will be
encoded as named ones but all non lower ascii characters will be encoded into numeric entities.

@method encodeNumeric
@param {String} text Text to encode.
@param {Boolean} attr Optional flag to specify if the text is attribute contents.
@return {String} Entity encoded text.
Encodes the specified string using numeric entities . The core entities will be encoded as named ones but all non lower ascii characters will be encoded into numeric entities .