types/src/main/java/com/google/common/html/types/SafeUrls.java
public static SafeUrl createHtmlDataUrlBase64(SafeHtml html) {
    try {
      String dataUrl =
          "data:text/html;charset=UTF-8;base64,"
              + BaseEncoding.base64().encode(html.getSafeHtmlString().getBytes("UTF-8"));
      return create(dataUrl);
    } catch (UnsupportedEncodingException e) {
      // Should never happen.  We use getBytes(String) instead of getBytes(CharSet) because
      // there's no java.nio.charset.StandardCharsets in older Android SDKs.
      throw new RuntimeException(e);
    }
  }
public static SafeUrl createHtmlDataUrlBase64(SafeHtml html) {
    try {
      String dataUrl =
          "data:text/html;charset=UTF-8;base64,"
              + BaseEncoding.base64().encode(html.getSafeHtmlString().getBytes("UTF-8"));
      return create(dataUrl);
    } catch (UnsupportedEncodingException e) {
      // Should never happen.  We use getBytes(String) instead of getBytes(CharSet) because
      // there's no java.nio.charset.StandardCharsets in older Android SDKs.
      throw new RuntimeException(e);
    }
  }
Creates a {@code data:text/html} URL whose content is populated from the given
{@code SafeHtml} object.

<p>The resulting {@code data}-scheme URL's content is UTF-8-encoded, and further encoded using
base-64 transfer encoding.

@see http://tools.ietf.org/html/rfc2397
@see https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs