Android string encoding and html entities converting

Tramway11 picture Tramway11 · Jul 14, 2013 · Viewed 22.1k times · Source

There is a String in Android Java. How do I change it to another given encoding and replace HTML-entities such as & with &?

This is so that international symbols can be displayed correctly.

Answer

Tarsem Singh picture Tarsem Singh · Jul 14, 2013

to decode Html String you can use Html.fromHtml()

like

Html.fromHtml((String) htmlCode).toString();

if you want reverse

than you can use TextUtils.htmlEncode()