code: public static SafeUrl createHtmlDataUrl(SafeHtml html) {
      // Use urlPathSegmentEscaper because all other Escapers convert spaces to "+" instead of "%20",
      // which are rendered as normal "+"s in the browser instead of being rendered as spaces.
      String dataUrl =
          "data:text/html;charset=UTF-8,"
              + UrlEscapers.urlPathSegmentEscaper().escape(html.getSafeHtmlString());
      return create(dataUrl);
    }
docs: 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, but the
  encoding of non-ASCII characters is done using the standard %xx hex encoding.
  
  @see http://tools.ietf.org/html/rfc2397
  @see https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs