How to encode HTML in JAVA (Remove HTML from your text)
Here is the following code :-
--------------------------------------------------------------------------
private String htmlEncode(final String string) {
String value="";
try{
byte ptext[] = string.getBytes("ISO-8859-1");
value = new String(ptext,"UTF-8");
value=value.replaceAll("\\p{C}", "?");
}catch(Exception e)
{
Util.AppendExceptionToLog(e);
}
return value;
}
--------------------------------------------------------------------------
Thanks
Pavan Dhokne
8888865193
--------------------------------------------------------------------------
private String htmlEncode(final String string) {
String value="";
try{
byte ptext[] = string.getBytes("ISO-8859-1");
value = new String(ptext,"UTF-8");
value=value.replaceAll("\\p{C}", "?");
}catch(Exception e)
{
Util.AppendExceptionToLog(e);
}
return value;
}
--------------------------------------------------------------------------
Thanks
Pavan Dhokne
8888865193
Comments
Post a Comment