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&apos;s measurements height 5&apos;10.5&quot; hips 36&#148; waist 23.5&#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
Post a Comment