public static String encode(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( "&#");
	               buf.append((int) c);
	               buf.append(';');
	           }
	       }
	       return buf.toString();
	}