public HttpImageGetter encode(final Object id, final String html) {
        if (TextUtils.isEmpty(html)) {
            return this;
        }

        CharSequence encoded = HtmlUtils.encode(html, loading);
        // Use default encoding if no img tags
        if (containsImages(html)) {
            CharSequence currentEncoded = rawHtmlCache.put(id, encoded);
            // Remove full html if raw html has changed
            if (currentEncoded == null
                    || !currentEncoded.toString().equals(encoded.toString())) {
                fullHtmlCache.remove(id);
            }
        } else {
            rawHtmlCache.remove(id);
            fullHtmlCache.put(id, encoded);
        }
        return this;
    }
Encode given HTML string and map it to the given id

@param id
@param html
@return this image getter
app/src/main/java/com/github/pockethub/android/util/HttpImageGetter.java