[1934]How to perform HTML entity encoding in Java By Anonymous on 2007/10/21 21:31:36 Rate public static String HTMLEntityEncode ( String s ) { StringBuffer buf = new StringBuffer ( ) ; for ( int i = 0; i < s.length ( ) ; i++ ) { char c = s.charAt ( i ) ; if ( c > ='a' && c < ='z' || c > ='A' && c < ='Z' || c > ='0' && c < ='9' ) { buf.append ( c ) ; } else { buf.append ( "" + ( int ) c + ";" ) ; } } return buf.toString ( ) ; }