Android string encoding and html entities converti

2019-02-16 08:51发布

问题:

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.

回答1:

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