code: private static void appendHexJavaScriptRepresentation(
        int codePoint, Appendable out)
        throws IOException {
      if (Character.isSupplementaryCodePoint(codePoint)) {
        // Handle supplementary Unicode values which are not representable in
        // JavaScript.  We deal with these by escaping them as two 4B sequences
        // so that they will round-trip properly when sent from Java to JavaScript
        // and back.
        char[] surrogates = Character.toChars(codePoint);
        appendHexJavaScriptRepresentation(surrogates[0], out);
        appendHexJavaScriptRepresentation(surrogates[1], out);
        return;
      }
      out.append("\\u")
          .append(HEX_CHARS[(codePoint >>> 12) & 0xf])
          .append(HEX_CHARS[(codePoint >>> 8) & 0xf])
          .append(HEX_CHARS[(codePoint >>> 4) & 0xf])
          .append(HEX_CHARS[codePoint & 0xf]);
    }
docs: Returns a JavaScript representation of the character in a hex escaped
  format.
  @param codePoint The code point to append.
  @param out The buffer to which the hex representation should be appended.