public static String htmlSingleQuotes(String str){
  str=str.replaceAll("[\']","&rsquo;");
  str=str.replaceAll("&#039;","&rsquo;");
  str=str.replaceAll("&#145;","&rsquo;");
  str=str.replaceAll("&#146;","&rsquo;");
  return str;
}

public static String htmlSingleQuotes ( String str ) { str = str . replaceAll ( "[\']" , "&rsquo;" ) ; str = str . replaceAll ( "&#039;" , "&rsquo;" ) ; str = str . replaceAll ( "&#145;" , "&rsquo;" ) ; str = str . replaceAll ( "&#146;" , "&rsquo;" ) ; return str ; }
replace single quotes characters with html entities .
