What's the difference between Android's Html.escapeHtml and TextUtils.htmlEncode ? When should I use one or the other?
<p>Android has two different ways to escape / encode HTML characters /  entities in Strings:</p>

<ul>
<li><p><a href="http://developer.android.com/reference/android/text/Html.html#escapeHtml(java.lang.CharSequence)" rel="noreferrer"><code>Html.escapeHtml(String)</code></a>, added in API 16 (Android 4.1). The docs say:</p>

<blockquote>
  <p>Returns an HTML escaped representation of the given plain text.</p>
</blockquote></li>
<li><p><a href="http://developer.android.com/reference/android/text/TextUtils.html#htmlEncode(java.lang.String)" rel="noreferrer"><code>TextUtils.htmlEncode(String)</code></a> For this one, the docs say:</p>

<blockquote>
  <p>Html-encode the string.</p>
</blockquote></li>
</ul>

<p>Reading the docs, they both seem to do pretty much the same thing, but, when testing them, I get some pretty mysterious (to me) output.</p>

<p>Eg. With the input: <code>&lt;p&gt;This is a quote ". This is a euro symbol: €. &lt;b&gt;This is some bold text&lt;/b&gt;&lt;/p&gt;</code></p>

<ul>
<li><p><code>Html.escapeHtml</code> gives:</p>

<pre><code>&amp;lt;p&amp;gt;This is a quote ". This is a euro symbol: &amp;#8364;. &amp;lt;b&amp;gt;This is some bold text&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;
</code></pre></li>
<li><p>Whereas <code>TextUtils.htmlEncode</code> gives:</p>

<pre><code>&amp;lt;p&amp;gt;This is a quote &amp;quot;. This is a euro symbol: €. &amp;lt;b&amp;gt;This is some bold text&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;
</code></pre></li>
</ul>

<p>So it seems that the second escapes / encodes the quote (<strong>"</strong>), but the first doesn't, although the first encodes the Euro symbol, but the second doesn't. I'm confused.</p>

<hr>

<p>So what's the difference between these two methods ? Which characters does each escape / encode ? What's the difference between <em>encoding</em> and <em>escaping</em> here ? When should I use one or the other (or should I, gasp, use them both together ?) ?</p>