code: public static String htmlEncode(final String html) {
          validate(html, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
          return html.chars().mapToObj(c -> "\\u" + String.format("%04x", c).toUpperCase())
                  .map(HtmlEntities.encodedEntities::get).collect(joining());
      }
docs: Convert all applicable characters to HTML entities.
  
  @param html The HTML to encode
  @return The encoded data