Hi,
I am new to JSP, migrating from ASP, and I am looking for equivalent Java
functions for common ASP ones. I have found equivalents (and more!) for most
of them, but I miss an equivalent for Server.HTMLEncode, an ASP function
that encodes a Unicode text into HTML. So far, I use the following code :

String HTMLEncode( String str ) {
 String res = "";

 if( str == null ) return res;

 for( int i = 0; i < str.length(); i++ ) {
  char c = str.charAt( i );
  switch( c ) {
   case '<' : res += "&lt;"; break;
   case '>' : res += "&gt;"; break;
   case '&' : res += "&amp;"; break;
   default : res += c;
  }
 }

 return res;
}

this works fine, but I feel like rewriting the wheel. Is there such a
function in the Java API ?
Regards,
MP

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to