HTML Entities in PHP and Java

0

I'm using htmlentities () in PHP to store data in the database, replacing ç , ã , and other characters by HTML entities:

<?PHP
htmlentities ("Ampliação");
//Resulta na string "Amplia&ccedil;&atilde;o

In Java (Android) I need to decode these entities to their respective source values ("Magnification"), but I did not find an effective solution, just the

  

StringEscapeUtils.unescapeHtml4 (String)

but it is converting to characters other than originals, as well as being deprecated.

The method

  

URLDecoder.decoder (String)

It also did not result in the original string.

Any tips?

    
asked by anonymous 26.09.2017 / 02:31

1 answer

1

You can use the Html.fromHtml () . Here is an example:

String value =  Html.fromHtml(sua_string).toString();

For more details, see here for documentation .

    
26.09.2017 / 20:45