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

Key Features that Make Java More Secure than Other Languages

VPS Detail and Amazon Linux also we can use VPS.

Understanding Oauth2 (you have a option of login)