Hi Muthu

Thanks for the reply !!  I am still a little puzzled though.  Doesn't the
method you sent just replicate the functionality of URLEncoder and
URLDecoder ?

Cheers
Lee

_________________________________

Lee Turner
Systems Developer
Information Technology Leeds
_________________________________

Watt Gilchrist Ltd
Ring Road, West Park
Leeds, LS16 6RA
Tel: 0113 288 3200
Fax: 0113 275 1690
http://www.wattgilchrist.co.uk
_________________________________


> -----Original Message-----
> From: R.Muthukumar [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, April 11, 2001 12:20 PM
> To:   [EMAIL PROTECTED]
> Subject:      Re: Special Characters
>
> Hi Lee,
> Instead of using the URLEncoder and URLDecoder, use the asp equivalent of
> htmlEncode method. Just call this method before u insert the values into
> Oracle.
> public static String htmlEncode(String text) {
>    if (text == null) {
>     return "";
>    }
>
>    StringBuffer results = null;
>    char[] orig = null;
>    int beg = 0, len = text.length();
>    for (int i = 0; i < len; ++i){
>     char c = text.charAt(i);
>     switch (c){
>      case 0:
>      case '&':
>      case '<':
>      case '>':
>      case '"':
>      if (results == null){
>       orig = text.toCharArray();
>       results = new StringBuffer(len+10);
>      }
>      if (i > beg) {
>       results.append(orig, beg, i-beg);
>      }
>      beg = i + 1;
>      switch (c){
>       default: // case 0:
>       continue;
>       case '&':
>       results.append("&amp;");
>       break;
>       case '<':
>       results.append("&lt;");
>       break;
>       case '>':
>       results.append("&gt;");
>       break;
>       case '"':
>       results.append("&quot;");
>       break;
>      }
>     break;
>    }
>   }
>   if (results == null)
>   return text;
>   results.append(orig, beg, len-beg);
>   return results.toString();
>  }
> Rgds
> Muthu
>
> ----- Original Message -----
> From: "Lee Turner" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, April 11, 2001 4:24 PM
> Subject: Special Characters
>
>
> > Hi
> >
> > I am testing my application by trying it out with special characters. I
> > have entered űŰ (with squiggly on top for those readers that don't see
> them)
> > in a field in the form. This gets translated into &#369;&#368; when sent
> to
> > the server. However, when I try to decode this back to it original form
> (
> > java.net.URLDecoder.decode(req.getParameter("username")) ), it stays the
> > same and therefore &#369;&#368; gets entered into the database (Oracle).
> >
> > Is this correct when using these characters or am I missing something ??
> >
> > Cheers
> >
> > Lee
> >
> > _________________________________
> >
> > Lee Turner
> > Systems Developer
> > Information Technology Leeds
> > _________________________________
> >
> > Watt Gilchrist Ltd
> > Ring Road, West Park
> > Leeds, LS16 6RA
> > Tel: 0113 288 3200
> > Fax: 0113 275 1690
> > http://www.wattgilchrist.co.uk
> > _________________________________
> >
> >
> ==========================================================================
> =
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> >  http://java.sun.com/products/jsp/faq.html
> >  http://www.esperanto.org.nz/jsp/jspfaq.html
> >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
> ==========================================================================
> =
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to