Android string encoding and html entities converting Android string encoding and html entities converting android android

Android string encoding and html entities converting


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()


You can add denpendency:

implementation group: 'org.apache.commons', name: 'commons-text', version: '1.3'

And use StringEscapeUtils.unescapeHtml4(s), then get the result.