escapedUnicodeString(str, textType) {
    var serializer = this;
    return str.replace(/[\s\S]/g, function(char) {
      var unicode = char.codePointAt();
      if (unicode < 128) {
        return char;
      } else if (textType == serializer.INPUT_TEXT_TYPE.HTML) {
        return '&#' + unicode + ';';
      } else {
        return '\\' + unicode.toString(16);
      }
    });
  }
/**
   * Returns the string that is passed as an argument with all non ascii unicode
   * characters escaped.
   *
   * @param {string} str The string that should have its characters escaped.
   * @param {number} textType A possible value of |this.INPUT_TEXT_TYPE| which
   *     represents the type of text being escaped.
   * @return {string} The correctly escaped string.
   */
Returns the string that is passed as an argument with all non ascii unicode
characters escaped.

@param {string} str The string that should have its characters escaped.
@param {number} textType A possible value of |this.INPUT_TEXT_TYPE| which
represents the type of text being escaped.
@return {string} The correctly escaped string.
Returns the string that is passed as an argument with all non ascii unicode characters escaped . @param { string } str The string that should have its characters escaped . @param { number } textType A possible value of |this . INPUT_TEXT_TYPE| which represents the type of text being escaped . @return { string } The correctly escaped string .
escapedUnicodeString(str, textType) {
    var serializer = this;
    return str.replace(/[\s\S]/g, function(char) {
      var unicode = char.codePointAt();
      if (unicode < 128) {
        return char;
      } else if (textType == serializer.INPUT_TEXT_TYPE.HTML) {
        return '&#' + unicode + ';';
      } else {
        return '\\' + unicode.toString(16);
      }
    });
  }
escapedUnicodeString ( str , textType ) { var serializer = this ; return str . replace ( / [\s\S] / g , function ( char ) { var unicode = char . codePointAt ( ) ; if ( unicode < 128 ) { return char ; } else if ( textType == serializer . INPUT_TEXT_TYPE . HTML ) { return '&#' + unicode + ';' ; } else { return '\\' + unicode . toString ( 16 ) ; } } ) ; }
Returns the string that is passed as an argument with all non ascii unicode
 characters escaped.
Returns the string that is passed as an argument with all non ascii unicode characters escaped .