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

Comments

Popular posts from this blog

How to resolve session timeout issue in JAVA

Blog gives you enthusiasm,zeal