java - Replacing HTML code with character entity -


i have string contains html code ” & ’ etc. want replace respective entity set (" & ') in java. have tried following code.


if (stringutils.isnotblank(string)) {     string = stringescapeutils.unescapexml(string);     string = stringescapeutils.unescapehtml(string);     string = string.replaceall("<.*?>", "");     string = string.trim(); } 

input string :

brief tie side, string style embellished shimmering silver sequins.  dangling gunmetal chain tassels decorate end of each hip tie. model&amp;apos;s  measurements   height 5&amp;apos;10.5&amp;quot; hips 36&amp;#148; waist 23.5&amp;#148;  model wears size 2 

i getting following output contains badencoding:

brief tie side, string style embellished shimmering silver  sequins. dangling gunmetal chain tassels decorate end of each hip tie. model's  measurements   height 5'10.5" hips 36<94> waist 23.5<94> bust 35<94> model wears size 2 

required output:

brief tie side, string style embellished shimmering silver sequins.  dangling gunmetal chain tassels decorate end of each hip tie. model's  measurements   height 5'10.5" hips 36" waist 23.5" bust 35" model wears size 2 

kindly suggest.

if concern numeric character escapes, number character number , can used directly converting int , thence char. see http://www.w3.org/international/questions/qa-escapes


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -